diff options
-rw-r--r-- | src/tty.rs | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -193,6 +193,9 @@ pub fn new<T: ToWinsize>(config: &Config, options: &Options, size: T) -> Pty { } // Setup child stdin/stdout/stderr as slave fd of pty + // Ownership of fd is transferred to the Stdio structs and will be closed by them at the end of + // this scope. (It is not an issue that the fd is closed three times since File::drop ignores + // error on libc::close.) builder.stdin(unsafe { Stdio::from_raw_fd(slave) }); builder.stderr(unsafe { Stdio::from_raw_fd(slave) }); builder.stdout(unsafe { Stdio::from_raw_fd(slave) }); @@ -248,9 +251,6 @@ pub fn new<T: ToWinsize>(config: &Config, options: &Options, size: T) -> Pty { // Handle SIGCHLD libc::signal(SIGCHLD, sigchld as _); - - // Parent doesn't need slave fd - libc::close(slave); } unsafe { // Maybe this should be done outside of this function so nonblocking |