On 11/23/19 4:54 AM, aliak wrote:
Is there a way to go about killing a process after spawning it on a SIGINT?

I can't do this for e.g. because kill is not @nogc.

Pid currentSpawnedPid;
extern(C) void killCurrentPidHandler(int sig) nothrow @nogc @system {
   kill(currentSpawnedPid, sig);
}

int main() {
  currentSpawnedPid = spawnProcess(["docker-compose", "up"], stdin, stdout, stderr);
   signal(SIGINT, &killCurrentPidHandler);
   return wait(currentSpawnedPid);
}

Any other ways to go about this?

Yeah, fix phobos. kill should be @nogc/nothrow, and probably @safe.

-Steve

Reply via email to