Skip to content

Fix non-interactive cmd.sh#5187

Open
Flamefire wants to merge 2 commits into
easybuilders:developfrom
Flamefire:fix-non-interactive-cmd.sh
Open

Fix non-interactive cmd.sh#5187
Flamefire wants to merge 2 commits into
easybuilders:developfrom
Flamefire:fix-non-interactive-cmd.sh

Conversation

@Flamefire
Copy link
Copy Markdown
Contributor

@Flamefire Flamefire commented May 5, 2026

When running bash -i with -c it might have unintended side effects, like modifying the parent processes state.
This manifests e.g. in the tests:
python -m test.framework.suite test_run_shell_cmd_basic causes the process to go to background and stall until typing fg on the 2nd invocation of run_shell_cmd with cmd.sh -c ...

Using BASH_ENV for the non-interactive use avoids this while still sourcing the env file.
To detect that the presence of any argument to cmd.sh is used as for interactive usage none would be present.

See https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html

Flamefire added 2 commits May 5, 2026 10:27
When running `bash -i` with `-c` it might have unintended side effects,
like modifying the parent processes state.
This manifests e.g. in the tests:
`python -m test.framework.suite test_run_shell_cmd_basic` causes the
process to go to background and stall until typing `fg` on the 2nd
invocation of `run_shell_cmd` with `cmd.sh -c ...`

Using `BASH_ENV` for the non-interactive use avoids this while still
sourcing the env file.
To detect that the presence of any argument to `cmd.sh` is used as for
interactive usage none would be present.
Otherwise the space won't be printed when it is empty and the regex fails.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants