You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Should it be possible to use this library in a package that also reads input from the console? I wrote the following test program that I expected to wait for me to press control c, then prompt me for input, and then echo that input back to me:
extern crate ctrlc;
use std::sync::mpsc;
use std::io;
fn main() {
println!("Waiting for Ctrl-C...");
let (tx, rx) = mpsc::channel();
ctrlc::set_handler(move || tx.send(()).unwrap());
rx.recv().unwrap();
println!("Waiting for input...");
let mut line = String::new();
println!("{:?}", io::stdin().read_line(&mut line));
println!("Line: {}", line);
}
On macOS 10.12.1 and rust-ctrlc v2.* (due to #14), the call to read_line fails:
On Windows 10, after pressing Ctrl-C, it prints "Waiting for input..." and then immediately exits without printing anything else/any errors. If I add a panic to the last line just to make sure it's not something funky with the standard output, it never makes it there.
The text was updated successfully, but these errors were encountered:
Are you running the executable with cargo run? There's a known issue #11 that Cargo sets up its own signal handlers and there might be some side effects due to that.
I'm also getting Input/output error if I run with cargo run but running the executable directly seems to work (at least on my Linux machine):
$ target/debug/ctrlctest
Waiting for Ctrl-C...
^CWaiting for input...
hello world
Ok(12)
Line: hello world
Uh oh!
There was an error while loading. Please reload this page.
Should it be possible to use this library in a package that also reads input from the console? I wrote the following test program that I expected to wait for me to press control c, then prompt me for input, and then echo that input back to me:
On macOS 10.12.1 and rust-ctrlc v2.* (due to #14), the call to
read_line
fails:On Windows 10, after pressing Ctrl-C, it prints "Waiting for input..." and then immediately exits without printing anything else/any errors. If I add a panic to the last line just to make sure it's not something funky with the standard output, it never makes it there.
The text was updated successfully, but these errors were encountered: