namespace pharext;
+/**
+ * Execute system command
+ */
class ExecCmd
{
/**
public function __construct($command, $verbose = false) {
$this->command = $command;
$this->verbose = $verbose;
-
- /* interrupt output stream */
- if ($verbose) {
- printf("\n");
- }
}
/**
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;
/**
* Run the command
* @param array $args
- * @throws \Exception
+ * @throws \pharext\Exception
*/
public function run(array $args = null) {
$exec = escapeshellcmd($this->command);
}
if ($this->status) {
- throw new \Exception("Command {$this->command} failed ({$this->status})");
+ throw new Exception("Command {$this->command} failed ({$this->status})");
}
}
* @return int
*/
public function getStatus() {
- return $status;
+ return $this->status;
}
/**