isProcessRunning

Check whether a process with the given PID is currently running.

On Posix this uses kill(pid, 0): no signal is sent, but the kernel validates whether the target process exists and the caller has permission to signal it. ESRCH ("no such process") is the only errno value that conclusively means the process is gone.

On Windows this opens a query handle via OpenProcess and reads the exit code with GetExitCodeProcess. If the handle cannot be opened the function returns false (process absent or inaccessible).

  1. bool isProcessRunning(int pid)
    @trusted nothrow
    bool
    isProcessRunning
    (
    int pid
    )
  2. bool isProcessRunning(Pid pid)

Parameters

pid int

OS-level process identifier as a raw integer.

Return Value

Type: bool

true if the process appears to be running, false otherwise.

Meta