PTY 
The pty crate provides pty::fork(). That makes a parent process fork with new pseudo-terminal (PTY).
This crate depends on followings:
libclibrary- POSIX environment
Usage
Add this to your Cargo.toml:
[]
= "0.1"
and this to your crate root:
extern crate pty;
pty::fork()
This function returns two values. pty::Child represents a child process. pty::Master represents master of a PTY.
let = fork;
For example, the following code spawns tty(1) command by pty::fork() and outputs the result of the command.
extern crate libc;
extern crate pty;
use CString;
use Read;
use ptr;
When run this, we get new PTY in the child process.
$ tty
/dev/pts/5
$ cargo run
Running `target/debug/example`
child tty is: /dev/pts/8
Contributing
- Fork it ( https://github.com/hibariya/pty-rs/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
License
Copyright (c) 2015 Hika Hibariya
Distributed under the MIT License.