mirror of
https://github.com/wez/wezterm.git
synced 2024-11-22 22:42:48 +03:00
Ensure that the pty is the controlling terminal for the child
This commit is contained in:
parent
8080718c71
commit
2d739eb667
16
src/pty.rs
16
src/pty.rs
@ -172,14 +172,18 @@ impl SlavePty {
|
||||
}
|
||||
|
||||
// Establish ourselves as a session leader.
|
||||
// On Linux, this will implicitly result in the pty
|
||||
// being set as the controlling terminal when we exec
|
||||
// the program momentarily.
|
||||
if libc::setsid() == -1 {
|
||||
Err(io::Error::last_os_error())
|
||||
} else {
|
||||
Ok(())
|
||||
return Err(io::Error::last_os_error());
|
||||
}
|
||||
|
||||
// Set the pty as the controlling terminal.
|
||||
// Failure to do this means that delivery of
|
||||
// SIGWINCH won't happen when we resize the
|
||||
// terminal, among other undesirable effects.
|
||||
if libc::ioctl(0, libc::TIOCSCTTY, 0) == -1 {
|
||||
return Err(io::Error::last_os_error());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user