Skip to content

Commit

Permalink
Kill any running tasks when force closed
Browse files Browse the repository at this point in the history
  • Loading branch information
stevebauman committed Nov 23, 2023
1 parent 82a820f commit c99afea
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Fork.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,15 @@ protected function listenForSignals(): void

protected function exit(): void
{
if (extension_loaded('posix')) {
posix_kill(getmypid(), SIGKILL);
if (! extension_loaded('posix')) {
exit;
}

exit;
foreach ($this->runningTasks as $task) {
posix_kill($task->pid(), SIGKILL);
}

posix_kill(getmypid(), SIGKILL);
}

protected function currentlyInChildTask(int $pid): bool
Expand Down

0 comments on commit c99afea

Please sign in to comment.