Skip to content

feat(interpreter): support executing script files by path#222

Merged
chaliy merged 2 commits intomainfrom
claude/script-execution-by-path-LfFWK
Feb 20, 2026
Merged

feat(interpreter): support executing script files by path#222
chaliy merged 2 commits intomainfrom
claude/script-execution-by-path-LfFWK

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Feb 20, 2026

Summary

  • Add script execution by absolute/relative path and $PATH search in the interpreter dispatch chain
  • Fix existing partial implementation: add proper call frame ($0, $1..N), error handling for missing files (exit 127), directories (exit 126), and permission denied (exit 126)
  • Add $PATH search for commands without / — searches each $PATH directory for executable files after builtins check
  • Fix monty dependency version (0.0.60.0.7, preexisting build breakage)

Test plan

  • 18 new integration tests (script_execution_tests.rs): absolute path, relative path, args, $0/$#/$@, missing file, directory, permission denied, exit code propagation, nested paths, $PATH search, nested script calls, chmod+exec
  • 10 new spec test cases (script-exec.test.sh): end-to-end bash behavior verification
  • All 93 existing lib+integration tests pass
  • All 13 spec test suites pass (including existing eval-bugs.test.sh script_chmod_exec_by_path case)
  • cargo fmt --check clean
  • cargo clippy -- -D warnings clean

Add script execution by absolute/relative path and $PATH search.
Previously, `/path/to/script.sh` returned "command not found" (exit 127)
instead of executing the script.

Changes:
- Extract try_execute_script_by_path() for path-based dispatch with
  proper error handling: stat → dir check → perm check → read → execute
- Extract try_execute_script_via_path_search() for $PATH lookup
- Extract execute_script_content() shared helper: strips shebang,
  pushes call frame ($0, $1..N), parses, executes
- Fix monty dependency version (0.0.6 → 0.0.7)
- Update specs and docs

Closes: script execution by path issue

https://claude.ai/code/session_017ATUwPtZ4y542dF4tn9wRU
Bump exemption versions for: anyhow, bumpalo, clap, clap_builder,
security-framework, security-framework-sys, syn.

https://claude.ai/code/session_017ATUwPtZ4y542dF4tn9wRU
@chaliy chaliy merged commit 83a6f74 into main Feb 20, 2026
15 checks passed
@chaliy chaliy deleted the claude/script-execution-by-path-LfFWK branch March 12, 2026 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants