add testcase for exit code handling
This commit is contained in:
parent
52db21bb2c
commit
8d85809d62
2 changed files with 20 additions and 0 deletions
18
tests/osproc/texitcode.nim
Normal file
18
tests/osproc/texitcode.nim
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
discard """
|
||||||
|
file: "texitcode.nim"
|
||||||
|
output: ""
|
||||||
|
"""
|
||||||
|
import osproc, os
|
||||||
|
|
||||||
|
const filename = when defined(Windows): "tfalse.exe" else: "tfalse"
|
||||||
|
|
||||||
|
doAssert fileExists(getCurrentDir() / "tests" / "osproc" / filename)
|
||||||
|
|
||||||
|
var p = startProcess(filename, getCurrentDir() / "tests" / "osproc")
|
||||||
|
doAssert(waitForExit(p) == QuitFailure)
|
||||||
|
|
||||||
|
p = startProcess(filename, getCurrentDir() / "tests" / "osproc")
|
||||||
|
var running = true
|
||||||
|
while running:
|
||||||
|
running = running(p)
|
||||||
|
doAssert(waitForExit(p) == QuitFailure)
|
||||||
2
tests/osproc/tfalse.nim
Normal file
2
tests/osproc/tfalse.nim
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
import system
|
||||||
|
quit(QuitFailure)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue