diff --git a/crates/runc/src/io.rs b/crates/runc/src/io.rs index 95493fe..29277fe 100644 --- a/crates/runc/src/io.rs +++ b/crates/runc/src/io.rs @@ -16,8 +16,9 @@ use std::fmt::{self, Debug, Formatter}; use std::fs::File; use std::io::Result; +use std::ops::Deref; use std::os::unix::io::{AsRawFd, FromRawFd}; -use std::sync::Mutex; +use std::sync::{Arc, Mutex}; use nix::unistd::{Gid, Uid}; @@ -53,6 +54,28 @@ impl Debug for dyn Io { } } +impl Io for Arc { + fn stdin(&self) -> Option { + self.deref().stdin() + } + + fn stdout(&self) -> Option { + self.deref().stdout() + } + + fn stderr(&self) -> Option { + self.deref().stderr() + } + + fn set(&self, cmd: &mut Command) -> Result<()> { + self.deref().set(cmd) + } + + fn close_after_start(&self) { + self.deref().close_after_start() + } +} + #[derive(Debug, Clone)] pub struct IOOption { pub open_stdin: bool,