Add warning to specify timeout value in milliseconds, Fix #21449 (#21471)

a warning message been added to the documentation to remind users that the timeout parameter is expressed in milliseconds, not seconds. to help prevent confusion and unexpected behaviours.
This commit is contained in:
Sultan Al Isaiee 2023-03-04 18:53:57 +04:00 • committed by GitHub
commit 04a494f8cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -220,6 +220,10 @@ proc waitForExit*(p: Process, timeout: int = -1): int {.rtl,
## ##
## On posix, if the process has exited because of a signal, 128 + signal ## On posix, if the process has exited because of a signal, 128 + signal
## number will be returned. ## number will be returned.
##
## .. warning:: When working with `timeout` parameters, remember that the value is
## typically expressed in milliseconds, and ensure that the correct unit of time
## is used to avoid unexpected behavior.
proc peekExitCode*(p: Process): int {.rtl, extern: "nosp$1", raises: [OSError], tags: [].} proc peekExitCode*(p: Process): int {.rtl, extern: "nosp$1", raises: [OSError], tags: [].}
## Return `-1` if the process is still running. Otherwise the process' exit code. ## Return `-1` if the process is still running. Otherwise the process' exit code.