Skip to content

Commit

Permalink
Fix incorrect stdio ctors on Unix
Browse files Browse the repository at this point in the history
  • Loading branch information
kubkon committed May 2, 2020
1 parent e5cb103 commit efca399
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/wasi-common/src/sys/unix/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ impl StdioExt for Stdio {
Ok(Box::new(Self::In { rights }))
}
fn stdout() -> io::Result<Box<dyn Handle>> {
let file = unsafe { File::from_raw_fd(io::stdin().as_raw_fd()) };
let file = unsafe { File::from_raw_fd(io::stdout().as_raw_fd()) };
let file = ManuallyDrop::new(file);
let rights = get_rights(&file)?;
let rights = Cell::new(rights);
Ok(Box::new(Self::Out { rights }))
}
fn stderr() -> io::Result<Box<dyn Handle>> {
let file = unsafe { File::from_raw_fd(io::stdin().as_raw_fd()) };
let file = unsafe { File::from_raw_fd(io::stderr().as_raw_fd()) };
let file = ManuallyDrop::new(file);
let rights = get_rights(&file)?;
let rights = Cell::new(rights);
Expand Down

0 comments on commit efca399

Please sign in to comment.