Repository navigation
fix: run packaged shell scripts and capture their output - #379
migueltheduck wants to merge 1 commit into
Conversation
Since bundle v2 the packager puts every app file under app/, but the runtime still resolved .sh entry points from the package root, so every packaged shell app failed to load with MissingScript. Shell scripts now resolve from the app directory, falling back to the package root. The bash path also never read the script's stdout or stderr, losing its output and blocking any script that filled the pipe buffer. It now forwards both to the program channel, runs in its own process group so cancellation stops the script's children, and clears the environment in protected mode, as uv run does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
Why
Since bundle v2 the packager puts every app file under
app/, butvalidate_invoke_scriptand the runtime still resolved a.shentry point from the package root. Every CLI-built shell app therefore fails withMissingScript, locally and on Tower.Once found, the bash path had three more problems the uv path doesn't:
bashbut left its children running.What
Package::resolve_invoke_pathresolves the script from the app directory. Only for.shdoes it fall back to the package root, so hand-built bundles withinvoke = "app/run.sh"keep working. Packaging-time validation and the runtime both use it.forward_outputhelper replaces the copies of the drain code in the uv steps.execute_bash_programruns in its own process group, normalizes env vars asuv rundoes (tower_uv::normalize_env_varsis nowpub), and clears the environment in protected mode.07-bash-scriptwith two tests: output and env in protected mode (about 200 KB of output), and cancel stopping a backgroundedsleep. Both fail ondevelop.Compatibility
Bundles that already point
invokeat the right path keep working: v1 bundles resolve as before, and a hand-builtinvoke = "app/run.sh"is still found through the root fallback. In protected mode a shell script now gets the same environment as a Python app (Tower's variables plus the hostPATH) instead of the whole host environment.