pty-shell 0.2.0

Spawn a shell and control it through pty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
extern crate pty_shell;

use self::pty_shell::*;

#[test]
fn it_can_hook_stdout_with_callback() {
    let child = tty::Fork::from_ptmx().unwrap();
    restore_termios();

    child.proxy(PtyCallback::new()
            .output(|data| assert!(data.len() != 0))
            .build())
        .unwrap();
    child.exec("pwd").unwrap();

    assert!(child.wait().is_ok());
}