diff options
author | Mark Leyva <maleyva1@users.noreply.github.com> | 2024-07-01 02:42:11 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-01 11:42:11 +0200 |
commit | 288d5c4ac32c27704258a15d365a56dadf38b0e9 (patch) | |
tree | ed893d80cced41d52dbe410607dc5df4ada283cf /tests/osproc | |
parent | 4202b606b19f032e2a34056eaa384e46b5f97496 (diff) | |
download | Nim-288d5c4ac32c27704258a15d365a56dadf38b0e9.tar.gz |
fixes #5091; Ensure we don't wait on an exited process on Linux (#23743)
Fixes #5091. Ensure we don't wait on an exited process on Linux
Diffstat (limited to 'tests/osproc')
-rw-r--r-- | tests/osproc/twaitforexit.nim | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/osproc/twaitforexit.nim b/tests/osproc/twaitforexit.nim new file mode 100644 index 000000000..5db8d2566 --- /dev/null +++ b/tests/osproc/twaitforexit.nim @@ -0,0 +1,18 @@ +import std/[osproc, os, times] + +block: # bug #5091 + when defined(linux): + const filename = "false" + var p = startProcess(filename, options = {poStdErrToStdOut, poUsePath}) + os.sleep(1000) # make sure process has exited already + + let atStart = getTime() + const msWait = 2000 + + try: + discard waitForExit(p, msWait) + except OSError: + discard + + # check that we don't have to wait msWait milliseconds + doAssert(getTime() < atStart + milliseconds(msWait)) \ No newline at end of file |