X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Fpharext%2FExecCmd.php;h=3ea63d00438f2887c8f69ce9c5ee1e3e008adf3f;hb=861260c111bff72f60665393660b6f5375559510;hp=056f0b28c5dc3947a3024a05e5c8d10e725c1aa4;hpb=d774f309d3216bf1923f6bd5b49ee0fb287e0ce7;p=pharext%2Fpharext diff --git a/src/pharext/ExecCmd.php b/src/pharext/ExecCmd.php index 056f0b2..3ea63d0 100644 --- a/src/pharext/ExecCmd.php +++ b/src/pharext/ExecCmd.php @@ -2,6 +2,9 @@ namespace pharext; +/** + * Execute system command + */ class ExecCmd { /** @@ -41,11 +44,6 @@ class ExecCmd public function __construct($command, $verbose = false) { $this->command = $command; $this->verbose = $verbose; - - /* interrupt output stream */ - if ($verbose) { - printf("\n"); - } } /** @@ -65,7 +63,7 @@ class ExecCmd private function suExec($command, &$output, &$status) { if (!($proc = proc_open($command, [STDIN,["pipe","w"],["pipe","w"]], $pipes))) { $status = -1; - throw new \Exception("Failed to run {$command}"); + throw new Exception("Failed to run {$command}"); } $stdout = $pipes[1]; $passwd = 0; @@ -89,7 +87,7 @@ class ExecCmd /** * Run the command * @param array $args - * @throws \Exception + * @throws \pharext\Exception */ public function run(array $args = null) { $exec = escapeshellcmd($this->command); @@ -112,7 +110,7 @@ class ExecCmd } if ($this->status) { - throw new \Exception("Command {$this->command} failed ({$this->status})"); + throw new Exception("Command {$this->command} failed ({$this->status})"); } } @@ -121,7 +119,7 @@ class ExecCmd * @return int */ public function getStatus() { - return $status; + return $this->status; } /**