Menu

#1572 Fix handling $SCRIPT variable in terminal command for some cases

Undefined
open
nobody
None
Patch
2025-11-12
2025-11-12
No
  1. compilergcc: fix handling '$SCRIPT' in RunSingleFile

The variable handling in RunSingleFile() is incorrect
and differs from the one in the Run() function.

So on replacing $SCRIPT, the path to the executable file was placed
BEFORE the console_runner command, and not AFTER, as it should be.

As a result, before this patch all terminal commands specifying $SCRIPT did not work
on single file launching.

  1. compilergcc: fix handling spaces in command

Quote if needed instead escaping spaces, because it didn't work in some cases,
for example if we set terminal to xdg-terminal "$SCRIPT" or terminology -M -T $TITLE -e "$SCRIPT"

Because somewhere when running this command,
escaping spaces in the path of the executable file is lost,
but if the path is quoted, then this problem does not arise.

  1. cbplugin: fix handling '$SCRIPT' on launching debugger

Replace this variable with sleep command, if $SCRIPT is specified in terminal command.

This is bug fix, when the $SCRIPT variable is not processed at all when launching the debugger (when launching the debugger, the terminal starts with the sleep command at the input).

When using a terminal with -e support, then there is no problem, because there is no need to wrap the command being executed in quotation marks (all input arguments are escaped by the terminal itself as one executed command). But in the case of the xdg-terminal, the $SCRIPT variable itself is used to wrap the command in quotes, since it does not have -e or an analog.

So, if we use $SCRIPT with terminal command, before this patch the 'sleep' command is simply added to the end, but instead the $SCRIPT in the command should be replaced with 'sleep' in order for everything to work as intended.

3 Attachments

Discussion


Log in to post a comment.