diff --git a/src/Helper/ProcessHelper.php b/src/Helper/ProcessHelper.php index 20d35969..89e780bf 100644 --- a/src/Helper/ProcessHelper.php +++ b/src/Helper/ProcessHelper.php @@ -78,7 +78,7 @@ public function runCommand($command, $allowFailures = false, $callback = null) $process->run($callback); if (!$process->isSuccessful() && !$allowFailures) { - throw new \RuntimeException($process->getErrorOutput()); + throw new \RuntimeException(trim($process->getErrorOutput()), (int) $process->getExitCode()); } return trim($process->getOutput()); diff --git a/tests/Helper/GitHelperTest.php b/tests/Helper/GitHelperTest.php index 2210d4ab..559c80ad 100644 --- a/tests/Helper/GitHelperTest.php +++ b/tests/Helper/GitHelperTest.php @@ -102,15 +102,14 @@ public function returns_false_when_top_git_dir_was_expected() } /** - * @test * @runInSeparateProcess */ - public function returns_false_for_non_git_dir() + public function testThrowExceptionForNonGitDir() { chdir(sys_get_temp_dir()); + $this->setExpectedExceptionRegExp('\RuntimeException', '#^fatal: Not a git repository \(or any of the parent directories\): \.git$#', 128); $this->assertFalse($this->git->isGitDir()); - $this->assertFalse($this->git->isGitDir(false)); } /**