diff options
Diffstat (limited to 'crates/shirabe-external-packages/src/symfony/process/pipes/unix_pipes.rs')
| -rw-r--r-- | crates/shirabe-external-packages/src/symfony/process/pipes/unix_pipes.rs | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/process/pipes/unix_pipes.rs b/crates/shirabe-external-packages/src/symfony/process/pipes/unix_pipes.rs index aff2a544..a7026318 100644 --- a/crates/shirabe-external-packages/src/symfony/process/pipes/unix_pipes.rs +++ b/crates/shirabe-external-packages/src/symfony/process/pipes/unix_pipes.rs @@ -11,22 +11,13 @@ use shirabe_php_shim::{Descriptor, PhpMixed, PhpResource}; pub struct UnixPipes { inner: AbstractPipes, tty_mode: Option<bool>, - pty_mode: bool, - have_read_support: bool, } impl UnixPipes { - pub fn new( - tty_mode: Option<bool>, - pty_mode: bool, - input: PhpMixed, - have_read_support: bool, - ) -> Self { + pub fn new(tty_mode: Option<bool>, input: PhpMixed) -> Self { Self { inner: AbstractPipes::new(input), tty_mode, - pty_mode, - have_read_support, } } } @@ -35,23 +26,12 @@ fn descriptor(items: &[&str]) -> Descriptor { match items { ["pipe", mode] => Descriptor::Pipe(mode.to_string()), ["file", path, mode] => Descriptor::File(path.to_string(), mode.to_string()), - ["pty"] => Descriptor::Pty, _ => panic!("unsupported descriptor spec: {:?}", items), } } impl PipesInterface for UnixPipes { fn get_descriptors(&mut self) -> Vec<Descriptor> { - if !self.have_read_support { - let nullstream = - shirabe_php_shim::fopen("/dev/null", "c").expect("fopen('/dev/null') failed"); - return vec![ - descriptor(&["pipe", "r"]), - Descriptor::Resource(nullstream.clone()), - Descriptor::Resource(nullstream), - ]; - } - if self.tty_mode == Some(true) { return vec![ descriptor(&["file", "/dev/tty", "r"]), @@ -60,14 +40,6 @@ impl PipesInterface for UnixPipes { ]; } - if self.pty_mode && Process::is_pty_supported() { - return vec![ - descriptor(&["pty"]), - descriptor(&["pty"]), - descriptor(&["pty"]), - ]; - } - vec![ descriptor(&["pipe", "r"]), descriptor(&["pipe", "w"]), @@ -146,10 +118,6 @@ impl PipesInterface for UnixPipes { read } - fn have_read_support(&self) -> bool { - self.have_read_support - } - fn are_open(&self) -> bool { !self.inner.pipes.is_empty() } |
