-
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
process immediate exit after sigterm #36
Comments
I was not able to reproduce this on macOS, but I was able to reproduce this on Ubuntu. The |
Thx for fix. But signals still broadcasted to child process. How i can prevent it ? I handled signals in my parent process and want to send it to child only from code. |
Also signal handling not worked after that fix. I changed test.php scrip: <?php
require __DIR__.'/vendor/autoload.php';
\Amp\Loop::run(function(){
$process = new \Amp\Process\Process("php test-process.php");
$pid = yield $process->start();
\Amp\ByteStream\pipe($process->getStdout(), \Amp\ByteStream\getStdout());
\Amp\ByteStream\pipe($process->getStderr(), \Amp\ByteStream\getStderr());
$onInterrupt = \Amp\Loop::onSignal(SIGINT, function ($reference) use ($process){
echo "sigterm\n";
yield new \Amp\Delayed(5000);
echo "terminating child\n";
$process->signal(SIGINT);
\Amp\Loop::cancel($reference);
});
$code = yield $process->join();
echo $code;
if(file_exists("/proc/{$pid}")) {
echo "Process still running\n";
}
yield new \Amp\Delayed(10000);
\Amp\Loop::cancel($onInterrupt);
}); As you can see:
As i can see sigint briadcasted on step 2 but i can't send it manually on step 3. May be need to use posix_kill instead of proc_terminate ? |
As i understand i cannot prevent SIGINT sent to process group. But problem with sending signal to children process from code still exist |
Fix sending signals to the child process in d51bd9a using |
Thx. I use Process::signal in my code. |
Some example code to reproduce
test.php
test-process.php
Steps to reproduce
Process list:
Processs list:
Actual behavior
As you can see when sigint received php closed process wrapper (sh -c) and send sigint to
test-process.php
. amp/Process wait for process wrapper to finish but doesn't wait fortest-process.php
. But pipes will continue to work after that. The child process only killed after main process exit.Expected behavior
Process::join
only resolves whentest-process.php
finished/halted/cancelled.The text was updated successfully, but these errors were encountered: