Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix processes silently ignoring the CWD when it does not exist #9695

Merged
merged 1 commit into from Feb 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 (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->errorOutput = null;

Expand Down