我正在尝试从php脚本级别执行这样的命令:
git log --pretty='format:%H %cI %s' v1.13.3..v1.13.3
但我收到一条消息
fatal: ambiguous argument '%cI': unknown revision or path not in the working tree.
执行代码如下:
protected static function run(string $command)
{
$process = proc_open($command, [
1 => ['pipe', 'w'],
2 => ['pipe', 'w']
], $pipes);
if (false !== $process) {
list(, $stdout, $stderr) = array_map(function ($resource) {
$content = explode("\n", stream_get_contents($resource));
fclose($resource);
return $content;
}, $pipes);
$status = proc_close($process);
if ($status !== 0) {
$error = count($stderr) ? ': ' . implode("\n", $stderr) : '';
throw new ExecutionException(sprintf("Executing process '%s' failed" . $error, $command));
}
return $stdout;
}
throw new ExecutionException(sprintf("Failed opening process '%s'", $command));
}
我不做什么,为什么脚本不想执行该命令?