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?

Cheers,
- Ali

Reply via email to