From e2b9370f108dcd657d5fe29501289e6638783457 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Sat, 7 Sep 2019 16:59:13 +1200 Subject: [PATCH] Attempt to fix issue with ^C in Windows This fixes the error case if we ^C during running an external command. This needs testing across platforms before it lands. --- src/commands/classified.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/commands/classified.rs b/src/commands/classified.rs index 94e5656001..959a8f6125 100644 --- a/src/commands/classified.rs +++ b/src/commands/classified.rs @@ -342,7 +342,19 @@ impl ExternalCommand { match stream_next { StreamNext::Last => { - popen.wait()?; + let _ = popen.detach(); + loop { + match popen.poll() { + None => { + let _ = std::thread::sleep(std::time::Duration::new(0, 100000000)); + } + _ => { + let _ = popen.terminate(); + break; + } + } + } + println!(""); Ok(ClassifiedInputStream::new()) } StreamNext::External => {