Skip to content

Commit

Permalink
Fix processes silently ignoring the CWD when it does not exist, refs #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Feb 11, 2021
1 parent 4d2ae78 commit 2e16f3c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Composer/Repository/Vcs/GitDriver.php
Expand Up @@ -38,6 +38,9 @@ public function initialize()
{
if (Filesystem::isLocalPath($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;
$cacheUrl = realpath($this->url);
} else {
Expand Down
4 changes: 4 additions & 0 deletions src/Composer/Util/ProcessExecutor.php
Expand Up @@ -61,6 +61,10 @@ public function execute($command, &$output = null, $cwd = null)
$cwd = realpath(getcwd());
}

if (!is_dir($cwd)) {
throw new \RuntimeException('The given CWD for the process does not exist: '.$cwd);
}

$this->captureOutput = func_num_args() > 1;
$this->errorOutput = null;

Expand Down

0 comments on commit 2e16f3c

Please sign in to comment.