From a7f5d550c1567f9b150fc73891e1afeb4623cfba Mon Sep 17 00:00:00 2001 From: Simon Krauter Date: Mon, 3 Nov 2014 12:18:45 +0100 Subject: Added test case --- tests/stdlib/tosprocterminate.nim | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/stdlib/tosprocterminate.nim diff --git a/tests/stdlib/tosprocterminate.nim b/tests/stdlib/tosprocterminate.nim new file mode 100644 index 000000000..fd044414c --- /dev/null +++ b/tests/stdlib/tosprocterminate.nim @@ -0,0 +1,21 @@ +import os, osproc + +when defined(Windows): + const ProgramWhichDoesNotEnd = "notepad" +else: + const ProgramWhichDoesNotEnd = "/bin/sh" + +echo("starting " & ProgramWhichDoesNotEnd) +var process = startProcess(ProgramWhichDoesNotEnd) +sleep(500) +echo("stopping process") +process.terminate() +var TimeToWait = 5000 +while process.running() and TimeToWait > 0: + sleep(100) + TimeToWait = TimeToWait - 100 + +if process.running(): + echo("FAILED") +else: + echo("SUCCESS") -- cgit 1.4.1-2-gfad0