rexpect 0.7.0

Interact with unix processes/bash the same way as pexpect or Don libes expect does
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use rexpect::error::Error;
use rexpect::spawn;

fn main() -> Result<(), Error> {
    let mut p = spawn("ftp speedtest.tele2.net", Some(2000))?;
    p.exp_regex("Name \\(.*\\):")?;
    p.send_line("anonymous")?;
    p.exp_string("Password")?;
    p.send_line("test")?;
    p.exp_string("ftp>")?;
    p.send_line("cd upload")?;
    p.exp_string("successfully changed.\r\nftp>")?;
    p.send_line("pwd")?;
    p.exp_regex("[0-9]+ \"/upload\"")?;
    p.send_line("exit")?;
    p.exp_eof()?;
    Ok(())
}