Merge pull request #4828 from jfhg/unify_waitpid_handling

Unify waitpid handling
This commit is contained in:
Andreas Rumpf 2016-10-09 19:03:12 +02:00 • committed by GitHub
commit f46168d654
3 changed files with 57 additions and 32 deletions

3
tests/osproc/tafalse.nim Normal file
View file

@ -0,0 +1,3 @@
# 'tafalse.nim' to ensure it is compiled before texitcode.nim
import system
quit(QuitFailure)

View file

@ -0,0 +1,18 @@
discard """
file: "texitcode.nim"
output: ""
"""
import osproc, os
const filename = when defined(Windows): "tafalse.exe" else: "tafalse"
let dir = getCurrentDir() / "tests" / "osproc"
doAssert fileExists(dir / filename)
var p = startProcess(filename, dir)
doAssert(waitForExit(p) == QuitFailure)
p = startProcess(filename, dir)
var running = true
while running:
running = running(p)
doAssert(waitForExit(p) == QuitFailure)