WIFSIGNALED means process has exited too (with a bang!) (#5678)
This commit is contained in:
parent
40f79e6cdd
commit
0055729755
6 changed files with 95 additions and 18 deletions
36
tests/osproc/texitsignal.nim
Normal file
36
tests/osproc/texitsignal.nim
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
discard """
|
||||
output: '''true
|
||||
true'''
|
||||
targets: "c"
|
||||
"""
|
||||
|
||||
import os, osproc
|
||||
when not defined(windows):
|
||||
import posix
|
||||
|
||||
# Checks that the environment is passed correctly in startProcess
|
||||
# To do that launches a copy of itself with a new environment.
|
||||
|
||||
if paramCount() == 0:
|
||||
# Parent process
|
||||
|
||||
let p = startProcess(
|
||||
getAppFilename(),
|
||||
args = @["child"],
|
||||
options = {poStdErrToStdOut, poUsePath, poParentStreams}
|
||||
)
|
||||
|
||||
echo p.running()
|
||||
|
||||
p.kill()
|
||||
|
||||
when defined(windows):
|
||||
# windows kill happens using TerminateProcess(h, 0), so we should get a
|
||||
# 0 here
|
||||
echo p.waitForExit() == 0
|
||||
else:
|
||||
# on posix (non-windows), kill sends SIGKILL
|
||||
echo p.waitForExit() == 128 + SIGKILL
|
||||
|
||||
else:
|
||||
sleep(5000) # should get killed before this
|
||||
Loading…
Add table
Add a link
Reference in a new issue