-
Notifications
You must be signed in to change notification settings - Fork 377
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
Implement dup and close for stdin/stdout/stderr #1511
Conversation
@samrat what is the status of this? Trying to make sure it does not get lost. :) |
@RalfJung I'll try to address the comments on the PR sometime this weekend. Sorry for having been a bit laggy with follow-ups on this issue(and the last :/ ) |
It's okay, delays happen. :) I just want to make sure this doesn't get lost. |
cf0e1e0
to
9addda3
Compare
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 is great, thanks a lot for working through all my comments. :)
I have just one last minor nit. Then, could you please squash these commits together? And then we can land this. :D
src/shims/posix/fs.rs
Outdated
Ok(0) | ||
} | ||
let result = file_descriptor.close(this.machine.communicate)?; | ||
|
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.
Spurious empty line, I think?
570eef9
to
d4538af
Compare
Removed the newline and squashed all commits into one. |
@bors r+ |
📌 Commit d4538af has been approved by |
Implement dup and close for stdin/stdout/stderr Implements some of the operations for stdin/out/err, towards #1499
💔 Test failed - checks-travis |
|
||
fn main() { | ||
unsafe { | ||
libc::close(1); //~ ERROR stdout cannot be closed(not supported by Rust) |
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.
Ah, the error message here is still wrong.
(Please squash that fix.)
Support F_DUPFD on stdin/stdout/stderr Enable `close`-ing stdin/stdout/stderr For `dup`, check if FD is `File` first If not, clone the appropriate standard IO stream Merge POSIX `close` and `dup` tests into same module Also, add assertion that `write` on a closed FD returns an error. Add `dup` as FileDescriptor trait fn Also: - Fix `close` so it drops `self` instead of reference to it - Remove FD clamping in insert_fd_with_min_fd, since FDs 0-2 can be closed Fix fs_libc tests Make error message when closing stdin/out/err more specific Return io::Result from `FileDescriptor::dup` Change error message when closing stdin/out/err Refactor `FileDescriptor::dup` impl for `FileHandle` Remove empty line
d4538af
to
563fb8e
Compare
@bors r+ |
📌 Commit 563fb8e has been approved by |
☀️ Test successful - checks-travis, status-appveyor |
Implements some of the operations for stdin/out/err, towards #1499