Skip to content

fix(interpreter): handle command not found like bash#61

Merged
chaliy merged 2 commits intomainfrom
claude/handle-missing-dependencies-uRmsX
Feb 2, 2026
Merged

fix(interpreter): handle command not found like bash#61
chaliy merged 2 commits intomainfrom
claude/handle-missing-dependencies-uRmsX

Conversation

@chaliy
Copy link
Contributor

@chaliy chaliy commented Feb 2, 2026

Summary

  • Handle missing commands (like ssh, du) with bash-compatible behavior instead of raising a Rust error
  • Return exit code 127 and stderr message bash: <cmd>: command not found
  • Script continues execution after command not found (unless set -e)

Changes

Core fix (crates/bashkit/src/interpreter/mod.rs)

  • Changed Err(Error::CommandNotFound) to Ok(ExecResult::err(..., 127))
  • Error message format matches bash: bash: <cmd>: command not found

Tests (crates/bashkit/tests/threat_model_tests.rs)

  • Added 11 comprehensive test cases for command not found behavior
  • Updated existing tests to use .unwrap() and check exit code 127

Spec test (crates/bashkit/tests/spec_cases/bash/command-not-found.test.sh)

  • Added spec test file for bash compatibility comparison

Documentation (specs/006-threat-model.md)

  • Updated Process Escape section with bash-compatible behavior note
  • Updated test count (39 -> 51 tests)

Test plan

  • All 51 threat model tests pass
  • All unit tests pass (402 tests)
  • clippy passes with no warnings
  • cargo fmt passes
  • Rebased on latest main

https://claude.ai/code/session_01B8T58ASprjpcgJQkgb3qG9

Return exit code 127 and stderr message matching bash format
("bash: cmd: command not found") instead of a Rust error.
This allows scripts to continue execution after missing commands.

https://claude.ai/code/session_01B8T58ASprjpcgJQkgb3qG9
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

- Add 12 test cases for command not found behavior
- Update existing tests to use unwrap() and check exit 127
- Add spec test file for bash compatibility comparison
- Update threat model spec with bash-compatible behavior
- Update test count in threat model doc (39 -> 51)

https://claude.ai/code/session_01B8T58ASprjpcgJQkgb3qG9
@chaliy chaliy force-pushed the claude/handle-missing-dependencies-uRmsX branch from afc7f0a to 6d4e982 Compare February 2, 2026 05:52
@chaliy chaliy merged commit 6c8496a into main Feb 2, 2026
7 checks passed
@chaliy chaliy deleted the claude/handle-missing-dependencies-uRmsX branch February 2, 2026 06:00
@chaliy chaliy restored the claude/handle-missing-dependencies-uRmsX branch February 2, 2026 06:01
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