1
0
Fork 0

Merge pull request #9695 from Seldaek/avoid-invalid-dir

Fix processes silently ignoring the CWD when it does not exist
pull/9702/head
Jordi Boggiano 2021-02-11 13:04:26 +01:00 committed by GitHub
commit 812207c823
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -38,6 +38,9 @@ class GitDriver extends VcsDriver
{ {
if (Filesystem::isLocalPath($this->url)) { if (Filesystem::isLocalPath($this->url)) {
$this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url); $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url);
if (!is_dir($this->url)) {
throw new \RuntimeException('Failed to read package information from '.$this->url.' as the path does not exist');
}
$this->repoDir = $this->url; $this->repoDir = $this->url;
$cacheUrl = realpath($this->url); $cacheUrl = realpath($this->url);
} else { } else {

View File

@ -61,6 +61,10 @@ class ProcessExecutor
$cwd = realpath(getcwd()); $cwd = realpath(getcwd());
} }
if (null !== $cwd && !is_dir($cwd)) {
throw new \RuntimeException('The given CWD for the process does not exist: '.$cwd);
}
$this->captureOutput = func_num_args() > 1; $this->captureOutput = func_num_args() > 1;
$this->errorOutput = null; $this->errorOutput = null;