Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions crates/runc/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ use std::{
fmt::Debug,
fs::{File, OpenOptions},
io::Result,
os::unix::{fs::OpenOptionsExt, io::AsRawFd},
os::unix::{
fs::OpenOptionsExt,
io::{AsRawFd, OwnedFd},
},
process::Stdio,
sync::Mutex,
};

use log::debug;
use nix::unistd::{Gid, Uid};
use os_pipe::{PipeReader, PipeWriter};
#[cfg(feature = "async")]
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::net::unix::pipe;

use crate::Command;

Expand Down Expand Up @@ -100,8 +103,8 @@ impl Default for IOOption {
/// When one side of the pipe is closed, the state will be represented with [`None`].
#[derive(Debug)]
pub struct Pipe {
rd: PipeReader,
wr: PipeWriter,
rd: OwnedFd,
wr: OwnedFd,
}

#[derive(Debug)]
Expand All @@ -113,7 +116,9 @@ pub struct PipedIo {

impl Pipe {
fn new() -> std::io::Result<Self> {
let (rd, wr) = os_pipe::pipe()?;
let (tx, rx) = pipe::pipe()?;
let rd = tx.into_blocking_fd()?;
let wr = rx.into_blocking_fd()?;
Ok(Self { rd, wr })
}
}
Expand Down