From: Vincent Vanwaelscappel Date: Mon, 29 Aug 2022 16:04:13 +0000 (+0200) Subject: wip #5422 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=0916c468e26b000455d6249869862840ec525742;p=cubist_util.git wip #5422 --- diff --git a/src/CommandLine.php b/src/CommandLine.php index 95cfe94..48320a0 100644 --- a/src/CommandLine.php +++ b/src/CommandLine.php @@ -21,6 +21,7 @@ class CommandLine protected $ssh = null; protected $longArgSeparator = '='; protected $timeout = 0; + protected $json = false; function __construct($program, $output = null, $error = true) { @@ -205,6 +206,10 @@ class CommandLine $commande = 'nohup ' . $commande; } + if ($this->json) { + $commande = 'sudo ' . $commande; + } + $commandes[] = $commande; $this->commande = implode(';', $commandes); @@ -296,4 +301,20 @@ class CommandLine $this->timeout = $timeout; } + + /** + * @return bool + */ + public function isJson(): bool + { + return $this->json; + } + + /** + * @param bool $json + */ + public function setJson(bool $json): void + { + $this->json = $json; + } } diff --git a/src/CommandLine/Imagemagick/Npx.php b/src/CommandLine/Imagemagick/Npx.php deleted file mode 100644 index 4c2d29e..0000000 --- a/src/CommandLine/Imagemagick/Npx.php +++ /dev/null @@ -1,23 +0,0 @@ -setManualArg($module); - } - - public function execute($fonction = 'shell_exec') - { - parent::execute($fonction); - } -} \ No newline at end of file diff --git a/src/CommandLine/Npx.php b/src/CommandLine/Npx.php new file mode 100644 index 0000000..0f3824b --- /dev/null +++ b/src/CommandLine/Npx.php @@ -0,0 +1,23 @@ +setManualArg($module); + } + + public function execute($fonction = 'shell_exec') + { + parent::execute($fonction); + } +} \ No newline at end of file