Skip to content

enhance cmd.sh so it works in non-interactive mode, like when passing -c to run a command#5187

Merged
boegel merged 2 commits into
easybuilders:developfrom
Flamefire:fix-non-interactive-cmd.sh
Jun 13, 2026
Merged

enhance cmd.sh so it works in non-interactive mode, like when passing -c to run a command#5187
boegel merged 2 commits into
easybuilders:developfrom
Flamefire:fix-non-interactive-cmd.sh

Conversation

@Flamefire

@Flamefire Flamefire commented May 5, 2026

Copy link
Copy Markdown
Contributor

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

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.
@Flamefire Flamefire force-pushed the fix-non-interactive-cmd.sh branch from 2cfc0dd to 32f0f69 Compare June 12, 2026 07:19
@Flamefire

Flamefire commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

@boegel Rebased. Can we get this in soon? This is very annoying when testing locally.

@boegel boegel changed the title Fix non-interactive cmd.sh enhance cmd.sh so it works in non-interactive mode (by passing -c) Jun 13, 2026

@boegel boegel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@boegel boegel changed the title enhance cmd.sh so it works in non-interactive mode (by passing -c) enhance cmd.sh so it works in non-interactive mode, like when passing -c to run a command Jun 13, 2026
@boegel boegel merged commit 25fd748 into easybuilders:develop Jun 13, 2026
41 checks passed
@Flamefire Flamefire deleted the fix-non-interactive-cmd.sh branch June 13, 2026 17:56
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