1use expectrl::{spawn, stream::stdin::Stdin};
4use std::io::stdout;
5
6#[cfg(unix)]
7const SHELL: &str = "sh";
8
9#[cfg(windows)]
10const SHELL: &str = "powershell";
11
12#[cfg(not(all(windows, feature = "polling")))]
13#[cfg(not(feature = "async"))]
14fn main() {
15 let mut sh = spawn(SHELL).expect("Error while spawning sh");
16
17 println!("Now you're in interacting mode");
18 println!("To return control back to main type CTRL-] combination");
19
20 let mut stdin = Stdin::open().expect("Failed to create stdin");
21
22 sh.interact(&mut stdin, stdout())
23 .spawn()
24 .expect("Failed to start interact");
25
26 stdin.close().expect("Failed to close a stdin");
27
28 println!("Exiting");
29}
30
31#[cfg(feature = "async")]
32fn main() {
33 }
51
52#[cfg(all(windows, feature = "polling", not(feature = "async")))]
53fn main() {}