Skip to content

Commit

Permalink
Update SupervisorStartCommand.php
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbmaulana authored May 21, 2024
1 parent 3797f21 commit 72c3fda
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/Console/Commands/SupervisorStartCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Tripteki\Supervisor\Console\Commands;

use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessSignaledException;

class SupervisorStartCommand extends Supervisor
{
Expand Down Expand Up @@ -45,21 +46,24 @@ public function createForegroundProcess()
{
$supervisor = null;

$this->trap([ SIGINT, SIGTERM, SIGQUIT, ], function () use (&$supervisor) {
try {

if ($supervisor) {
$this->trap([ SIGINT, SIGTERM, SIGQUIT, ], function () use (&$supervisor) {

$supervisor->stop(3, SIGINT);
$supervisor->stop(15, SIGTERM);
}
if ($supervisor) {

$this->supervisor->delete();
});
$this->shouldKeepRunning = false;
}

if ($this->supervisor->write()) {
$this->supervisor->delete();
});

$supervisor = $this->exec("start", "foreground");
}
if ($this->supervisor->write()) {

$supervisor = $this->exec("start", "foreground");
}

} catch (ProcessSignaledException $thrower) {}
}

/**
Expand Down

0 comments on commit 72c3fda

Please sign in to comment.