From 0916c468e26b000455d6249869862840ec525742 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 29 Aug 2022 18:04:13 +0200 Subject: [PATCH] wip #5422 --- src/CommandLine.php | 21 +++++++++++++++++++++ src/CommandLine/{Imagemagick => }/Npx.php | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) rename src/CommandLine/{Imagemagick => }/Npx.php (89%) 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/Npx.php similarity index 89% rename from src/CommandLine/Imagemagick/Npx.php rename to src/CommandLine/Npx.php index 4c2d29e..0f3824b 100644 --- a/src/CommandLine/Imagemagick/Npx.php +++ b/src/CommandLine/Npx.php @@ -1,6 +1,6 @@