Skip to content

Commit 3d6a72c

Browse files
committed
async: Fix termios to be Sync
Workaround until nix-rust/nix#1324 merges
1 parent 6b7542b commit 3d6a72c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

async/src/pty.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,13 @@ pub fn raw_pty() -> Result<RawPtyGuard, IoError> {
6363
}
6464

6565
pub struct RawPtyGuard {
66-
saved: Termios,
66+
// nix Termios isn't Sync, pending https://github.com/nix-rust/nix/pull/1324
67+
saved: libc::termios,
6768
}
6869

6970
impl RawPtyGuard {
7071
fn new() -> Result<Self, IoError> {
71-
let saved = Self::set_raw()?;
72+
let saved = Self::set_raw()?.into();
7273

7374
Ok(Self {
7475
saved,
@@ -111,7 +112,7 @@ impl Drop for RawPtyGuard {
111112
fn drop(&mut self) {
112113
use nix::sys::termios::*;
113114
let fd = std::io::stdin().as_raw_fd();
114-
let r = tcsetattr(fd, SetArg::TCSADRAIN, &self.saved);
115+
let r = tcsetattr(fd, SetArg::TCSADRAIN, &self.saved.into());
115116
if let Err(e) = r {
116117
warn!("Failed restoring TTY: {e}");
117118
}

0 commit comments

Comments
 (0)