Skip to content

Proc

An open handle to a process that is not a child of this one.

Returned by open.

Using a closed handle raises StateError.

Fields

pid @ Int

The process ID.

Methods

close()

Closes the handle.

info() -> Info

Takes a fresh snapshot of process state.

kill()

Terminates the process aggressively in the manner typical for the target platform: SIGKILL on Unix, TerminateProcess() on Windows.

signal sig

Sends a signal to the process.

Parameters

NameTypeDescription
sig Signal Signal to send.

Errors

Exception Condition
sys.UnsupportedError The target is Windows

Example

let p = proc.open $pid
p.signal :HUP:

terminate()

Terminates the process in the manner typical for the target platform: SIGTERM on Unix, TerminateProcess() on Windows.

This is equivalent to kill on Windows, where there is no consistent way to terminate a non-child process gently.

wait() -> Status

Waits for the process to exit.