summaryrefslogtreecommitdiff
path: root/src/launcher.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/launcher.php')
-rw-r--r--src/launcher.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/launcher.php b/src/launcher.php
index d1b9892..8cd9fda 100644
--- a/src/launcher.php
+++ b/src/launcher.php
@@ -7,6 +7,8 @@ $job = null;
register_shutdown_function(function() {
global $job;
+ if ($job instanceof \jobd\exceptions\JobInterruptedException)
+ exit($job->getCode());
if ($job !== true)
exit(1);
});
@@ -25,6 +27,9 @@ if ($job->status != Job::STATUS_RUNNING)
try {
if ($job->run() !== false)
$job = true;
+} catch (\jobd\exceptions\JobInterruptedException $e) {
+ fprintf(STDERR, $e->getMessage()."\n");
+ $job = $e;
} catch (Exception $e) {
fprintf(STDERR, $e.'');
exit(1);