Add this to your Cargo.toml
:
```toml [dependencies]
pty = '0.1.6' pty-shell = '0.1.0' ```
and this to your crate root:
```rust extern crate pty; extern crate pty_shell;
use pty_shell::{PtyProxy, PtyHandler}; use std::process::{Command, Stdio};
struct Shell;
impl PtyHandler for Shell {
fn input(&mut self, _data: Vec
fn output(&mut self, _data: Vec<u8>) {
Command::new("aplay").arg("sound2.wav").stderr(Stdio::null()).spawn().unwrap();
}
}
fn main() { let child = pty::fork().unwrap();
child.exec("bash").unwrap();
child.proxy(Shell).unwrap();
child.wait().unwrap();
} ```
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Copyright (c) 2015 Hika Hibariya
Distributed under the MIT License.