From: Vincent Vanwaelscappel Date: Wed, 17 Jan 2024 06:31:32 +0000 (+0100) Subject: wip #6615 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=3b2db5bcb62e2d44b1156d446b3086da099a1e5b;p=cubist_util.git wip #6615 --- diff --git a/src/CommandLine.php b/src/CommandLine.php index 6e77add..c0c676f 100644 --- a/src/CommandLine.php +++ b/src/CommandLine.php @@ -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;