--- id: process-poll name: Process.poll category: process kind: namespace-method tokens: Process.poll sig: Process.poll(handle) -> int tip: -1 while running, else the exit code. order: 1 ns: Process member: poll --- Returns -1 while the child is still running and its exit code once it has ended; it never waits. The code is kept, so asking again gives the same answer until Process.free. A child ended by a signal (macOS) answers 128 plus the signal number, as a shell reports it — 137 after Process.kill, on both platforms. On Windows the code is the child's DWORD exit code as an int, so a crash such as 0xC0000005 arrives as a negative number (test for != 0, not > 0); a code of 0xFFFFFFFF is reported as 255 so that -1 always means "still running". A handle that is not one answers 255. ```ludic program Demo { var game: int = -1 handler Watch phase Update { if game >= 0 { let code = Process.poll(handle: game) if code >= 0 or code < -1 { if code != 0 { print("the game crashed") } Process.free(handle: game) game = -1 } } } } ```