You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] command -v ignores redirects, so command -v X >/dev/null still prints X #294
strands-shell -c 'if command -v ls >/dev/null 2>&1; then echo have-ls; fi'
strands-shell -c 'command -v cd > /tmp/x; cat /tmp/x'
Expected Behavior
As in dash/bash: the first prints only have-ls; the second writes cd into /tmp/x and cat prints it.
Actual Behavior
ls
have-ls
and for the second, cd goes to stdout, /tmp/x is never created, and cat fails with no such file or directory: /tmp/x. Exit statuses are correct, so if command -v X ... still branches right; the problem is the extra stdout output.
Additional Context
command -v NAME >/dev/null 2>&1 is the standard way agents probe for a tool, and PR #269 tells models to use command -v from the MCP tool description, so this noise will show up in their output.
Cause: src/exec.rs:3117-3158 handles command -v/-V inline and writes with proc.out_msg(...), but never applies pipeline[0].redirects. A few lines above, the exec branch keeps them (redirects: pipeline[0].redirects.clone()).
Possible Solution
Apply the simple command's redirects around the command -v output, or route command -v through the normal builtin dispatch so redirects and pipelines work the same way they do for other builtins.
Related Issues
#207, #269, #272 (which, "resolved like command -v")
Activity