From: Vincent Vanwaelscappel Date: Wed, 18 May 2022 20:08:22 +0000 (+0200) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=c10ca28c3684ed96ac2389363ff07090d77c02a9;p=cubist_util.git . --- diff --git a/src/CommandLine.php b/src/CommandLine.php index 8572925..95cfe94 100644 --- a/src/CommandLine.php +++ b/src/CommandLine.php @@ -20,6 +20,7 @@ class CommandLine protected $lang; protected $ssh = null; protected $longArgSeparator = '='; + protected $timeout = 0; function __construct($program, $output = null, $error = true) { @@ -196,6 +197,10 @@ class CommandLine } } + if ($this->getTimeout() > 0) { + $commande = 'timeout ' . $this->getTimeout() . ' ' . $commande; + } + if ($this->nohup) { $commande = 'nohup ' . $commande; } @@ -275,4 +280,20 @@ class CommandLine return $this->commande; } + /** + * @return int + */ + public function getTimeout(): int + { + return $this->timeout; + } + + /** + * @param int $timeout + */ + public function setTimeout(int $timeout): void + { + $this->timeout = $timeout; + } + }