Original bug ID: 6146 Reporter: Bardou Assigned to:@alainfrisch Status: closed (set by @xavierleroy on 2015-12-11T18:24:01Z) Resolution: fixed Priority: normal Severity: feature Platform: Windows Target version: 4.02.0+dev Category: otherlibs
I implemented terminate_process like this:
CAMLprim value o_terminate_process(value o_pid)
// The implementation of Unix.create_process returns the Handle as PID.
// Luckily this is exactly what we need.
HANDLE pid = (HANDLE) Long_val(o_pid);
BOOL result = TerminateProcess(pid, 0);
o_result = Val_bool(result);
external terminate_process: int -> bool = "o_terminate_process"
I figured I might as well share the code. This could be used either to implement Unix.kill at least for signal SIGKILL. Or, a new function terminate_process could be provided. Just like create_process exists to simulate the Windows function CreateProcess using the Unix function fork, the terminate_process would exist to simulate the Windows function TerminateProcess using the Unix function kill.
The text was updated successfully, but these errors were encountered:
LexiFi's version has implemented exactly that (implementing partially Unix.kill for Sys.sigkill). Unless someone argues in favor of a dedicated terminate_process function, I'll commit a version of the "Unix.kill" proposal.