From 989e35249eeb2b7e233dca56e25572c9c288f70c Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 7 Oct 2025 12:30:28 +0200 Subject: [PATCH] wip #7780 @0.25 --- src/CommandLine.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/CommandLine.php b/src/CommandLine.php index d6293d5..cf237d0 100644 --- a/src/CommandLine.php +++ b/src/CommandLine.php @@ -23,6 +23,7 @@ class CommandLine protected $ssh = null; protected $longArgSeparator = '='; protected $timeout = 0; + protected $cpulimit = 0; protected $sudo = false; protected $unique = false; protected $uniqueCommand = null; @@ -266,6 +267,10 @@ class CommandLine $commande = 'timeout ' . $this->getTimeout() . ' ' . $commande; } + if ($this->getCPULimit() > 0) { + $commande = 'cpulimit -l ' . $this->getCPULimit() . ' ' . $commande; + } + if ($this->nohup) { $commande = 'nohup ' . $commande; } @@ -423,6 +428,22 @@ class CommandLine $this->unique = $unique; } + /** + * @param int $cpulimit + */ + public function setCPULimit(int $cpulimit): void + { + $this->cpulimit = $cpulimit; + } + + /** + * @return int + */ + public function getCPULimit(): int + { + return $this->cpulimit; + } + public function ddCommand() { $this->_preExecute(); -- 2.39.5