-
Notifications
You must be signed in to change notification settings - Fork 3
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
Improve redirections #42
Conversation
It changes the semantics of `EDSL.with_redirections` to be the one of the shell's `exec` built-in.
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.
Looks cool, couple comments/Qs!
src/lib/EDSL.mli
Outdated
- then, ["printf"] outputs to [1]. | ||
|
||
Invalid cases, like redirecting to a file-descriptor has not been | ||
openned, lead to undefined behavior; see |
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.
opened*
src/test/main.ml
Outdated
write_output | ||
~return_value:tmp2#path ( | ||
with_redirections (exec ["printf"; "%s"; recognizable]) [ | ||
to_fd (int 4) (int 3); |
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.
is this doing anything?
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.
This redirection is the one that fails, since fd 3
is not yet opened.
In the POSIX case, with_redirections
then exits, in the bash/zsh case it keeps going.
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.
gotcha, now i understand what's going on 🙏
assert_or_fail "fd3" ( | ||
(tmp1#get =$= string "") | ||
||| | ||
(this_is_bash |
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 would we expect the file to have the string in it in bash? (and why only bash?)
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.
Bash does not exit on failed exec
calls.
Cf. #41
(and the doc-comments of EDSL.with_redirections
)
See issue #41 for some explanations of “how” and #40 for the “why.”