killWindows
Function parameters
Parameters
- self:*ChildProcess
- exit_code:windows.UINT
Type definitions in this namespace
Types
- StdIo
- Behavior of the child process's standard input, output, and error
- WindowsExtension
- File name extensions supported natively by `CreateProcess()` on Windows.
First argument in argv is the executable.
Functions
- init
- First argument in argv is the executable.
- spawn
- On success must call `kill` or `wait`.
- kill
- Forcibly terminates child process and then cleans up all resources.
- waitForSpawn
- On some targets, `spawn` may not report all spawn errors, such as `error.InvalidExe`.
- wait
- Blocks until child process terminates and then cleans up all resources.
- collectOutput
- Collect the output from the process's stdout and stderr.
- run
- Spawns a child process, waits for it, collecting stdout and stderr, and then returns.
Error sets in this namespace
Error Sets
Source
Implementation
pub fn killWindows(self: *ChildProcess, exit_code: windows.UINT) !Term {
if (self.term) |term| {
self.cleanupStreams();
return term;
}
windows.TerminateProcess(self.id, exit_code) catch |err| switch (err) {
error.AccessDenied => {
// Usually when TerminateProcess triggers a ACCESS_DENIED error, it
// indicates that the process has already exited, but there may be
// some rare edge cases where our process handle no longer has the
// PROCESS_TERMINATE access right, so let's do another check to make
// sure the process is really no longer running:
windows.WaitForSingleObjectEx(self.id, 0, false) catch return err;
return error.AlreadyTerminated;
},
else => return err,
};
try self.waitUnwrappedWindows();
return self.term.?;
}