-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stdstream support #168
stdstream support #168
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Could we add one more test that actually uses these streams, rather than just testing that the devices exist?
Here's a simple test script that reads a number x
from stdin and outputs 2x
on stdout and 3x
on stderr:
read x
echo $((x * 2))
echo $((x * 3)) >&2
We should be able to run echo 5 | try $SCRIPT
and get 10 on stdout and 15 on stderr. Similarly, we should be able to run echo 5 >FILE; try $SCRIPT <FILE
(NB redir is in our shell, not in try's arg) and get the same result.
That example would also pass outside of this PR since it seems like sh does not need /dev/std{in,out,err} for those streams. @mgree |
Oh! Good point lol. Then we should write a test that uses those devices appropriately. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be simpler and more precise.
EOF | ||
|
||
chmod +x "$cmdfile" | ||
|
||
result=$("$TRY" "$cmdfile") | ||
expected=$(sh "$cmdfile") | ||
# test stdout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not test for exact output from both at once by capturing output in mktemp
ed files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more test please... 🫣
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No diff on try stderr due to mount noise, I assume? LGTM thanks!
symlinks /dev/std{in,out,err} to /proc/self/fd/{0,1,2} and cleanup after
tests included