Skip to content

Commit

Permalink
Fix nix::Error conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
ftilde committed Jul 21, 2020
1 parent 8a65a61 commit 649e265
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/base/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,17 @@ impl<'a, T: Write + AsRawFd> Terminal<'a, T> {
stop_and_cont.add(SIGTSTP);

// 1. Unblock SIGTSTP and SIGCONT, so that we actually stop when we receive another SIGTSTP
pthread_sigmask(SigmaskHow::SIG_UNBLOCK, Some(&stop_and_cont), None)?;
pthread_sigmask(SigmaskHow::SIG_UNBLOCK, Some(&stop_and_cont), None)
.map_err(|e| e.as_errno().expect("Only expecting io errors"))?;

// 2. Reissue SIGTSTP (this time to whole the process group!)...
killpg(getpgrp(), SIGTSTP)?;
killpg(getpgrp(), SIGTSTP).map_err(|e| e.as_errno().expect("Only expecting io errors"))?;
// ... and stop!
// Now we are waiting for a SIGCONT.

// 3. Once we receive a SIGCONT we block SIGTSTP and SIGCONT again and resume.
pthread_sigmask(SigmaskHow::SIG_BLOCK, Some(&stop_and_cont), None)?;
pthread_sigmask(SigmaskHow::SIG_BLOCK, Some(&stop_and_cont), None)
.map_err(|e| e.as_errno().expect("Only expecting io errors"))?;

self.enter_tui()
}
Expand Down

0 comments on commit 649e265

Please sign in to comment.