Pid handle returned by spawnProcess or similar.
true if the process appears to be running, false otherwise.
isProcessRunning returns true for a live process and false after it exits
import unit_threaded.assertions; import std.process : spawnProcess, kill, wait; version(Posix) { auto pid = spawnProcess(["sleep", "10"]); } else version(Windows) { auto pid = spawnProcess(["cmd", "/c", "timeout", "/t", "10", "/nobreak"]); } int rawPid = pid.processID; isProcessRunning(rawPid).shouldBeTrue; isProcessRunning(pid).shouldBeTrue; pid.kill(); pid.wait(); isProcessRunning(rawPid).shouldBeFalse; isProcessRunning(pid).shouldBeFalse;
Check whether a process is currently running.
Overload accepting a std.process.Pid directly.