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
Crystal runtime crashes on closed file descriptor for STDIN #14569
Comments
Interestingly, |
This issue has been mentioned on Crystal Forum. There might be relevant details there: https://forum.crystal-lang.org/t/unable-to-get-info-bad-file-descriptor-io-error/6820/4 |
This issue has been mentioned on Crystal Forum. There might be relevant details there: https://forum.crystal-lang.org/t/unable-to-get-info-bad-file-descriptor-io-error/6820/12 |
As part of programm startup, the Crystal runtime initializes handles for the three standard streams.
If such a stream is already closed, the runtime crashes.
This affects any Crystal program which uses
STDIN
somehow (i.e. the constant is initialized).A minimal reproduction is
crystal <&-
(the shell redirection<&-
instructs that stdin is to be closed). This results in the following error:The same error does not appear when passing a closed output file descriptor (
crystal >&-
).I'm not sure how to reproduce in pure Crystal yet. Passing a closed
IO
toProcess.run
errors on the invoking process (Closed stream
fromProcess#copy_io
). This needs to be fixed as well.This was originally reported in https://forum.crystal-lang.org/t/unable-to-get-info-bad-file-descriptor-io-error/6820
The text was updated successfully, but these errors were encountered: