diff --git a/src/Composer/Repository/Vcs/GitDriver.php b/src/Composer/Repository/Vcs/GitDriver.php index 8c6902298557..2c7782c98fff 100644 --- a/src/Composer/Repository/Vcs/GitDriver.php +++ b/src/Composer/Repository/Vcs/GitDriver.php @@ -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 { diff --git a/src/Composer/Util/ProcessExecutor.php b/src/Composer/Util/ProcessExecutor.php index 83f19cf2d033..cb935e0eb239 100644 --- a/src/Composer/Util/ProcessExecutor.php +++ b/src/Composer/Util/ProcessExecutor.php @@ -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;