pty-shell 0.1.3

Spawn a shell and control it through pty
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use libc;
use std::{ffi, ptr};

pub fn exec<S: AsRef<str>>(shell: S) {
    let cmd = ffi::CString::new(shell.as_ref()).unwrap();
    let mut args: Vec<*const libc::c_char> = Vec::with_capacity(1);

    args.push(cmd.as_ptr());
    args.push(ptr::null());

    unsafe {
        libc::execvp(cmd.as_ptr(), args.as_mut_ptr());
    }
}