summary refs log tree commit diff stats
path: root/tests/osproc/twaitforexit.nim
blob: 5db8d256661d37733248746b42223326a349f3dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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))