You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bun run --filter, --parallel and --sequential ignore --shell and bunfig [run] shell #43232
printf'{"name":"app","version":"1.0.0","scripts":{"which":"echo $0"}}'> package.json
bun run --shell=bun which # which (Bun shell: $0 is the script name)
bun run --shell=system which # /usr/bin/bash (system shell)
bun run --shell=bun --filter '*' which # app which: /usr/bin/bash
What is the expected behavior?
--shell=bun (and bunfig [run] shell = "bun") selects Bun's shell for --filter, --parallel, --sequential and --workspaces runs, as it does for a plain bun run <script>. docs/runtime/bunfig.mdx says shell = "bun" is the way "to always use Bun's shell instead of the system shell".
What do you see instead?
The system shell runs the script. On an image without a system shell (FROM scratch, oven/bun:distroless), bun run --shell=bun --filter '*' start and bun run --shell=bun --parallel start exit 1 with error: MissingShell.
Additional information
src/runtime/cli/filter_run.rs (near line 937) and src/runtime/cli/multi_run.rs (near line 910) pick the interpreter by platform only and never read ctx.debug.use_system_shell. POSIX always runs <sh> -c <script> with the result of find_shell. Windows always runs bun exec <script>, so --shell=system is ignored there.
#43231 fixes the plain bun run <script> path (run_command.rs) and does not touch these two runners. To honor the flag here changes which shell runs existing --filter scripts, so it needs its own change and tests. echo $0 tells the two shells apart without a special image.
Notes from a separate pass at this fix, for the change that lands. The branch is robobun/a9d825b4/filter-parallel-honor-shell-flag (one commit, no PR). I did not open a PR, because a fix is already announced above. Use any part of it.
The direct fix is to read ctx.debug.use_system_shell and spawn bun exec <script> on POSIX when Bun's shell is wanted. That fix has two side effects.
1. bun exec loads the package's .env files.sh -c and plain bun run --shell=bun do not. Measured with a package .env that sets LEAKED=yes and a script that echoes it:
bun run --shell=system --filter dep0 script -> LEAK=
bun run --shell=bun --filter dep0 script -> LEAK=yes (direct fix)
cd packages/dep0 && bun run --shell=bun script -> LEAK=
This brings #9635 to POSIX. The branch spawns bun exec --no-env-file <script>, which is what #38182 does. Jarred's draft #39403 already carries #38182's ScriptArgv and shell_bin: Option<&'static ZStr> in both runners. The branch has its own small helper. A version that lands should match the ScriptArgv shape, so the runner hunks do not conflict.
2. --parallel fail-fast does not stop a running sibling under Bun's shell. The runner sends SIGINT to the direct child only. Bun's shell leaves SIGINT to its command and forwards nothing (src/spawn/ctrl_c.rs). bun run --parallel slow fail, where fail is sleep 1; exit 1:
slow is sleep 10
slow is sleep 10; echo x
system shell (bun 1.4.3)
1.1 s, sh -c execs the one command
10.0 s, x is printed
Bun's shell, with the fix
10.3 s
10.4 s
So the second column is how main behaves today. The fix moves one-command scripts of --shell=bun users into it. The runner waits for the sibling to exit, so a sibling that never exits keeps it alive. I did not test Ctrl+C from a terminal in that state. The branch does not solve this. #41802 (the shell forwards SIGTERM and SIGHUP) and #41478 (the runners wake on a signal) are the open changes that bear on it. A maintainer should decide if the fix can land before one of them.
Verified on the branch
test/cli/run/filter-workspace.test.ts and test/cli/run/multi-run.test.ts pass with a debug build on Linux and on Windows x64. bun 1.4.3 fails the 8 new --shell=bun cases on Linux, and the 6 new .env cases on Windows x64.
No system shell: with the hide-paths helper from bun run: do not look for a system shell when --shell=bun runs the script #43231 and an empty PATH, bun 1.4.3 prints error: MissingShell for --shell=bun with --filter, --parallel and --sequential. The branch runs the script and exits 0. --shell=system still fails with MissingShell.
Windows stays on bun exec whatever the setting is. From a read of the code, cmd.exe there needs the forwarded-argument check that plain bun run has (batch_arg_has_cmd_metachars), and multi_run.rs quotes the bun path for Bun's shell. I did not test cmd.exe.
Activity
robobun commentedon Sep 18, 2026
Reproduced:
bun run --shell=bun --filter "*" whichprints/usr/bin/bash, the plainbun run --shell=bun whichprintswhich.Fix in progress: #43235
robobun commentedon Sep 18, 2026
Notes from a separate pass at this fix, for the change that lands. The branch is
robobun/a9d825b4/filter-parallel-honor-shell-flag(one commit, no PR). I did not open a PR, because a fix is already announced above. Use any part of it.The direct fix is to read
ctx.debug.use_system_shelland spawnbun exec <script>on POSIX when Bun's shell is wanted. That fix has two side effects.1.
bun execloads the package's.envfiles.sh -cand plainbun run --shell=bundo not. Measured with a package.envthat setsLEAKED=yesand a script that echoes it:This brings #9635 to POSIX. The branch spawns
bun exec --no-env-file <script>, which is what #38182 does. Jarred's draft #39403 already carries #38182'sScriptArgvandshell_bin: Option<&'static ZStr>in both runners. The branch has its own small helper. A version that lands should match theScriptArgvshape, so the runner hunks do not conflict.2.
--parallelfail-fast does not stop a running sibling under Bun's shell. The runner sends SIGINT to the direct child only. Bun's shell leaves SIGINT to its command and forwards nothing (src/spawn/ctrl_c.rs).bun run --parallel slow fail, wherefailissleep 1; exit 1:slowissleep 10slowissleep 10; echo xsh -cexecs the one commandxis printedSo the second column is how main behaves today. The fix moves one-command scripts of
--shell=bunusers into it. The runner waits for the sibling to exit, so a sibling that never exits keeps it alive. I did not test Ctrl+C from a terminal in that state. The branch does not solve this. #41802 (the shell forwards SIGTERM and SIGHUP) and #41478 (the runners wake on a signal) are the open changes that bear on it. A maintainer should decide if the fix can land before one of them.Verified on the branch
test/cli/run/filter-workspace.test.tsandtest/cli/run/multi-run.test.tspass with a debug build on Linux and on Windows x64. bun 1.4.3 fails the 8 new--shell=buncases on Linux, and the 6 new.envcases on Windows x64.hide-pathshelper from bun run: do not look for a system shell when --shell=bun runs the script #43231 and an emptyPATH, bun 1.4.3 printserror: MissingShellfor--shell=bunwith--filter,--paralleland--sequential. The branch runs the script and exits 0.--shell=systemstill fails withMissingShell.bun execwhatever the setting is. From a read of the code, cmd.exe there needs the forwarded-argument check that plainbun runhas (batch_arg_has_cmd_metachars), andmulti_run.rsquotes the bun path for Bun's shell. I did not test cmd.exe.Jarred-Sumner commentedon Oct 8, 2026
Use handoff tool. GitHub issues are for user-facing issues and a user did not run into this issue