pub unsafe fn run_in_pty<F>(func: F) -> Result<(), Error> where
    F: FnOnce() -> Result<(), i32>, 
Expand description

Run a closure in a forked pseudoterminal process.

Limitations

  • No method of reading/writing the child’s stdout/stdin
  • Will not return until the child process exits or is killed.
    • That is, a stopped process that may be resumed will leave this function waiting until the process continues and then exits or is killed.

Errors

See [Error] for the possible error cases.

Safety

See nix::pty::forkpty. In short, do not use this in multithreaded applications unless you know what you are doing.