Skip to content

Commit

Permalink
Rollup merge of rust-lang#77724 - sunfishcode:stdinlock-asrawfd, r=al…
Browse files Browse the repository at this point in the history
…excrichton

Implement `AsRawFd` for `StdinLock` etc. on WASI.

WASI implements `AsRawFd` for `Stdin`, `Stdout`, and `Stderr`, so
implement it for `StdinLock`, `StdoutLock`, and `StderrLock` as well.

r? @alexcrichton
  • Loading branch information
JohnTitor authored Oct 12, 2020
2 parents 5d4cda6 + 8d2c622 commit 0c6b5cc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions library/std/src/sys/wasi/ext/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,21 @@ impl AsRawFd for io::Stderr {
sys::stdio::Stderr.as_raw_fd()
}
}

impl<'a> AsRawFd for io::StdinLock<'a> {
fn as_raw_fd(&self) -> RawFd {
sys::stdio::Stdin.as_raw_fd()
}
}

impl<'a> AsRawFd for io::StdoutLock<'a> {
fn as_raw_fd(&self) -> RawFd {
sys::stdio::Stdout.as_raw_fd()
}
}

impl<'a> AsRawFd for io::StderrLock<'a> {
fn as_raw_fd(&self) -> RawFd {
sys::stdio::Stderr.as_raw_fd()
}
}

0 comments on commit 0c6b5cc

Please sign in to comment.