Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pty): disable echoctl for child processes #8892

Merged
merged 1 commit into from
Jul 31, 2024
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
20 changes: 20 additions & 0 deletions crates/turborepo-lib/src/process/child.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,26 @@ impl ChildHandle {
let controller = pair.master;
let receiver = pair.slave;

#[cfg(unix)]
{
use nix::sys::termios;
if let Some((file_desc, mut termios)) = controller
.as_raw_fd()
.and_then(|fd| Some(fd).zip(termios::tcgetattr(fd).ok()))
{
// We unset ECHOCTL to disable rendering of the closing of stdin
// as ^D
termios.local_flags &= !nix::sys::termios::LocalFlags::ECHOCTL;
if let Err(e) = nix::sys::termios::tcsetattr(
file_desc,
nix::sys::termios::SetArg::TCSANOW,
&termios,
) {
debug!("unable to unset ECHOCTL: {e}");
}
}
}

let child = receiver
.spawn_command(command)
.map_err(|err| match err.downcast() {
Expand Down
Loading