You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get a ConsoleException when I run below command.
$git->repo->run("config core.safecrlf false");
And it seems in general I get that exception when I run commands that run successfully however don't return with anything.
My stack trace points to line 100 of Console.php
if ($status) throw new ConsoleException($stderr . PHP_EOL . $stdout);
And honestly that condition looks very sketchy. Shouldn't the conditional statement be checking if $status returns -1? And why are we trimming the return value anyway?
Full function from Command.php below.
public function runCommand($command)
{
$descriptorSpec = array(
1 => array('pipe', 'w'),
2 => array('pipe', 'w'),
);
$pipes = array();
/**
* Depending on the value of variables_order, $_ENV may be empty.
* In that case, we have to explicitly set the new variables with
* putenv, and call proc_open with env=null to inherit the reset
* of the system.
*
* This is kind of crappy because we cannot easily restore just those
* variables afterwards.
*
* If $_ENV is not empty, then we can just copy it and be done with it.
*/
if (count($_ENV) === 0) {
$env = NULL;
foreach ($this->envopts as $k => $v) {
putenv(sprintf("%s=%s", $k, $v));
}
} else {
$env = array_merge($_ENV, $this->envopts);
}
$cwd = $this->currentPath;
$resource = proc_open($command, $descriptorSpec, $pipes, $cwd, $env);
$stdout = stream_get_contents($pipes[1]);
$stderr = stream_get_contents($pipes[2]);
foreach ($pipes as $pipe) {
fclose($pipe);
}
$status = trim(proc_close($resource));
if ($status) throw new ConsoleException($stderr . PHP_EOL . $stdout);
return $stderr . $stdout;
}
}
The text was updated successfully, but these errors were encountered:
I get a ConsoleException when I run below command.
$git->repo->run("config core.safecrlf false");
And it seems in general I get that exception when I run commands that run successfully however don't return with anything.
My stack trace points to line 100 of Console.php
if ($status) throw new ConsoleException($stderr . PHP_EOL . $stdout);
And honestly that condition looks very sketchy. Shouldn't the conditional statement be checking if $status returns -1? And why are we trimming the return value anyway?
Full function from Command.php below.
The text was updated successfully, but these errors were encountered: