On Saturday, 23 November 2019 at 12:19:27 UTC, Steven Schveighoffer wrote:
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

Looked in to it, seems step one is getting phobos compiling with dip1008 :/
Kill uses enforce.

Reply via email to