fix(builtins): make xargs execute commands instead of echoing#364
Merged
fix(builtins): make xargs execute commands instead of echoing#364
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
xargsat the interpreter level (alongsidetimeout,eval,source) and dispatch constructedSimpleCommands viaexecute_command()-n 1per-item execution, and-I {}replacementCloses #346
Test plan
test_xargs_executes_command- verifiesecho file.txt | xargs catreads file contentstest_xargs_default_echo- verifiesecho 'a b c' | xargsdefaults to echotest_xargs_splits_newlines- verifies multi-line input is split into separate argstest_xargs_n1_executes_per_item- verifies-n 1executes once per argumenttest_xargs_replace_str- verifies-I {}substitution with actual execution-d,-0, etc.)cargo fmt --checkcleancargo clippy -p bashkit --all-targets --all-features -- -D warningscleancargo test -p bashkit --lib --all-features- 1109 tests passcargo test -p bashkit --all-features --tests- 118 integration tests pass