Added test case
This commit is contained in:
parent
f3d7158d5d
commit
a7f5d550c1
1 changed files with 21 additions and 0 deletions
21
tests/stdlib/tosprocterminate.nim
Normal file
21
tests/stdlib/tosprocterminate.nim
Normal file
|
|
@ -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")
|
||||
Loading…
Add table
Add a link
Reference in a new issue