amphp / process

An async process dispatcher for Amp.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Killing detached process

joelwurtz opened this issue · comments

Actually killing a process which is detached does not work

$process = new \Amp\Process\Process("setsid sleep 100");
$process->start();

$pid = yield $process->getPid();

$process->kill();

Then doing a ps aufx|grep sleep show the process still running, it is possible to kill him since we have the correct id and we can use then posix_kill, but should we do that (it introduce maybe a new extension dependency)

I'm not sure whether it's out job to kill a process which detached. STDIO and everything else still works fine for such a process?

Maybe not our job, but some users may not be aware that the process they launch will be detached, so maybe throwing an exception when trying to kill him or having a specific state ?

The thing is that the process the user actually launched is sh -c, we already do tricks to get the real processes PID. We should probably use that PID for sending signals, so that'd include kill() then.

Related bug: #29

I believe this has been resolved by merging #30. If not, please reopen this issue.