summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-02-09 23:37:49 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-02-09 23:37:49 +0100
commitfebe5359aaea69e8072fd0e28d01349e27dd6cc4 (patch)
tree93a237ec368d3a23c4a0c98f0ea3a61d3295bfa2
parent4cfb7ca7dda7b2fc73304fbfe04d97d4e7a5f9b2 (diff)
parent60c1ff7634d5c9471f00db395d260f7d288888fe (diff)
downloadnextcloud-server-febe5359aaea69e8072fd0e28d01349e27dd6cc4.tar.gz
nextcloud-server-febe5359aaea69e8072fd0e28d01349e27dd6cc4.zip
Merge pull request #22246 from owncloud/register-process-control-signal-handler-later
Register process control signel handlers only on execution of the com…
-rw-r--r--core/command/base.php22
1 files changed, 12 insertions, 10 deletions
diff --git a/core/command/base.php b/core/command/base.php
index a34d7ec1c9a..1591a2854db 100644
--- a/core/command/base.php
+++ b/core/command/base.php
@@ -49,15 +49,6 @@ class Base extends Command {
$this->defaultOutputFormat
)
;
-
- // check if the php pcntl_signal functions are accessible
- $this->php_pcntl_signal = function_exists('pcntl_signal');
- if ($this->php_pcntl_signal) {
- // Collect interrupts and notify the running command
- pcntl_signal(SIGTERM, [$this, 'cancelOperation']);
- pcntl_signal(SIGINT, [$this, 'cancelOperation']);
- }
-
}
/**
@@ -150,8 +141,19 @@ class Base extends Command {
*
* Gives a chance to the command to properly terminate what it's doing
*/
- private function cancelOperation() {
+ protected function cancelOperation() {
$this->interrupted = true;
}
+ public function run(InputInterface $input, OutputInterface $output) {
+ // check if the php pcntl_signal functions are accessible
+ $this->php_pcntl_signal = function_exists('pcntl_signal');
+ if ($this->php_pcntl_signal) {
+ // Collect interrupts and notify the running command
+ pcntl_signal(SIGTERM, [$this, 'cancelOperation']);
+ pcntl_signal(SIGINT, [$this, 'cancelOperation']);
+ }
+
+ return parent::run($input, $output);
+ }
}