Skip to content

Commit 4cd5e29

Browse files
khueymatthiasbeyer
authored andcommitted
Adapt nix::termios::tcsetattr call for nix 0.27.0
(cherry picked from commit cadf49c) Signed-off-by: Matthias Beyer <[email protected]>
1 parent bf1e1a9 commit 4cd5e29

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/process.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use nix::sys::{stat, termios};
1010
use nix::unistd::{close, dup, dup2, fork, setsid, ForkResult, Pid};
1111
use std;
1212
use std::fs::File;
13+
use std::io;
1314
use std::os::unix::io::{AsRawFd, FromRawFd};
1415
use std::os::unix::process::CommandExt;
1516
use std::process::Command;
@@ -118,9 +119,10 @@ impl PtyProcess {
118119
}
119120

120121
// set echo off
121-
let mut flags = termios::tcgetattr(STDIN_FILENO)?;
122+
let stdin = io::stdin();
123+
let mut flags = termios::tcgetattr(&stdin)?;
122124
flags.local_flags &= !termios::LocalFlags::ECHO;
123-
termios::tcsetattr(STDIN_FILENO, termios::SetArg::TCSANOW, &flags)?;
125+
termios::tcsetattr(&stdin, termios::SetArg::TCSANOW, &flags)?;
124126

125127
command.exec();
126128
Err(Error::Nix(nix::Error::last()))

0 commit comments

Comments
 (0)