add testcase for exit code handling

This commit is contained in:
Johannes Hofmann
2016-09-30 10:27:59 +02:00
parent 52db21bb2c
commit 8d85809d62
2 changed files with 20 additions and 0 deletions

View 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
View File

@@ -0,0 +1,2 @@
import system
quit(QuitFailure)