]> _ Git - cubist_util.git/commitdiff
wip #6615
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 17 Jan 2024 06:31:32 +0000 (07:31 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 17 Jan 2024 06:31:32 +0000 (07:31 +0100)
src/CommandLine.php

index 6e77add8b8c29bd28633e07e6e6673d3b4691cc7..c0c676ff86ee9a479f00e8ec26f0380387979307 100644 (file)
@@ -24,7 +24,7 @@ class CommandLine
     protected $timeout = 0;
     protected $sudo = false;
 
-    function __construct($program, $output = null, $error = true)
+    function __construct($program, $output = null, $error = true, $outputPrefix = null)
     {
         $p = $program;
 
@@ -36,11 +36,14 @@ class CommandLine
         $this->commande = null;
         if (null === $output) {
             $e = Text::multiExplode('/\\', $p);
-            $prefix = 'Cubist';
-            if (count($e)) {
-                $prefix = array_pop($e);
+            if (null === $outputPrefix) {
+                $outputPrefix = 'Cubist';
+                if (count($e)) {
+                    $outputPrefix = array_pop($e);
+                }
             }
-            $this->output = tempnam(sys_get_temp_dir(), $prefix ?: 'Cubist');
+
+            $this->output = tempnam(sys_get_temp_dir(), $outputPrefix ?: 'Cubist');
         } else {
             $this->temp_output = false;
             $this->output = $output;