Skip to content

Commit 5524b9b

Browse files
authored
Merge pull request #82 from ByteInternet/sigint_handler
2 parents f74f7ff + 71ee020 commit 5524b9b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/DeployRunner.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,12 @@ private function runStage(Deployer $deployer, string $stage, string $task = 'dep
303303
$tasks = $deployer->scriptManager->getTasks($task);
304304
$executor = $deployer->master;
305305

306+
pcntl_signal(SIGINT, function () {
307+
$this->log->warning("Received signal SIGINT, running fail jobs");
308+
// We don't have to do anything here. Underlying processes will receive the SIGINT signal as well
309+
// and that will cause the $exitCode below to be 255, which will cause the fail tasks to be run.
310+
});
311+
306312
/**
307313
* Set the env variable to tell deployer to deploy the hosts sequentially instead of parallel.
308314
* @see \Deployer\Executor\Master::runTask()

0 commit comments

Comments
 (0)