Terminating a Child Process.

Share:

Description

These functions give access to the state of the child process and to its exit status (return code).

The timeout parameter can take one of three values:

  • 0 which means no timeout

  • -1 which means "wait until there is data to read"

  • a positive integer, which is the actual timeout in milliseconds

TIMEOUT_INFINITE denotes an "infinite" timeout (that is, wait until response is available) when waiting for an operation to complete.

TIMEOUT_IMMEDIATE denotes an "immediate" timeout (in other words, no timeout) when waiting for an operation to complete.

Usage

1
2
3
4
5
6
7
8
9
process_poll(handle, timeout = TIMEOUT_IMMEDIATE)

process_return_code(handle)

process_wait(handle, timeout = TIMEOUT_INFINITE)

TIMEOUT_INFINITE

TIMEOUT_IMMEDIATE

Arguments

handle

Process handle obtained from spawn_process.

timeout

Optional timeout in milliseconds.

Format

An object of class integer of length 1.

Details

process_poll checks the state of the child process.

process_return_code complements process_poll by giving access to the child process' exit status (return code). If process_poll returns neither "exited" nor "terminated", process_return_code returns NA.

process_wait combined process_poll and process_return_code. It firsts for the process to exit and then returns its exit code.

Value

process_poll returns one of these values: "not-started". "running", "exited", "terminated".

See Also

spawn_process, process_read signals