Skip to content

fix(builtins): make xargs execute commands instead of echoing#364

Merged
chaliy merged 1 commit intomainfrom
claude/fix-346-xargs-execute-TjcEQ
Feb 27, 2026
Merged

fix(builtins): make xargs execute commands instead of echoing#364
chaliy merged 1 commit intomainfrom
claude/fix-346-xargs-execute-TjcEQ

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Feb 27, 2026

Summary

  • Fix xargs to execute commands through the interpreter instead of echoing them as text
  • Intercept xargs at the interpreter level (alongside timeout, eval, source) and dispatch constructed SimpleCommands via execute_command()
  • Add 5 integration tests covering: basic execution, default echo, newline splitting, -n 1 per-item execution, and -I {} replacement

Closes #346

Test plan

  • test_xargs_executes_command - verifies echo file.txt | xargs cat reads file contents
  • test_xargs_default_echo - verifies echo 'a b c' | xargs defaults to echo
  • test_xargs_splits_newlines - verifies multi-line input is split into separate args
  • test_xargs_n1_executes_per_item - verifies -n 1 executes once per argument
  • test_xargs_replace_str - verifies -I {} substitution with actual execution
  • All existing xargs unit tests still pass (option parsing, -d, -0, etc.)
  • cargo fmt --check clean
  • cargo clippy -p bashkit --all-targets --all-features -- -D warnings clean
  • cargo test -p bashkit --lib --all-features - 1109 tests pass
  • cargo test -p bashkit --all-features --tests - 118 integration tests pass

xargs was formatting command strings and outputting them as text instead
of actually executing the commands through the interpreter. Fix by
intercepting xargs at the interpreter level (like timeout, eval, source)
and dispatching constructed SimpleCommands via execute_command().

Closes #346
@chaliy chaliy merged commit bd16863 into main Feb 27, 2026
16 checks passed
@chaliy chaliy deleted the claude/fix-346-xargs-execute-TjcEQ branch February 27, 2026 06:26
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.

bug: xargs does not execute commands, just echoes them

2 participants