Skip to content
Open
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
6 changes: 6 additions & 0 deletions src/pty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use std::task::ready;
use nix::fcntl::{OFlag, open};
use nix::pty::{PtyMaster, grantpt, posix_openpt, ptsname, unlockpt};
use nix::sys::stat::Mode;
use nix::sys::termios::{SetArg, cfmakeraw, tcgetattr, tcsetattr};
use tokio::io::unix::AsyncFd;
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};

Expand All @@ -27,6 +28,11 @@ impl Pty {
grantpt(&fd)?;
unlockpt(&fd)?;

// Set raw mode on the server side
let mut termios = tcgetattr(&fd)?;
cfmakeraw(&mut termios);
tcsetattr(&fd, SetArg::TCSANOW, &termios)?;

// Get the pty path
let pty_name = unsafe { ptsname(&fd) }?;

Expand Down