Skip to content

Commit

Permalink
Fix DrumkitContext.
Browse files Browse the repository at this point in the history
  • Loading branch information
lamech committed Jul 29, 2019
1 parent 7026928 commit 8d3b0ad
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
3 changes: 3 additions & 0 deletions behat.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
default:
autoload:
- "%paths.base%/features/bootstrap"
- "%paths.base%/.mk/features/bootstrap"
suites:
default:
contexts:
Expand Down
21 changes: 14 additions & 7 deletions features/bootstrap/Drumkit/DrumkitContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ private function setOrigDir() {
}

protected function getOutput() {
return $this->process->getOutPut();
if ($this->process->isSuccessful()) {
return $this->process->getOutput();
}
return $this->process->getErrorOutput();
}

/**
Expand All @@ -66,15 +69,19 @@ private function exec($command) {
$this->process->setTimeout(300);
$this->process->run();

if ($this->debug) {
print_r("--- DEBUG START ---\n");
print_r($this->getOutput());
print_r("\n--- DEBUG END -----");
}
$this->printDebug();
}

private function printDebug() {
if (!$this->debug) return;
print_r("--- DEBUG START ---\n");
print_r($this->getOutput());
print_r("\n--- DEBUG END -----");
}

private function succeed($command) {
$this->exec($command);

if (!$this->process->isSuccessful()) {
throw new ProcessFailedException($this->process);
}
Expand All @@ -87,7 +94,7 @@ private function fail($command) {
$this->exec($command);

if ($this->process->isSuccessful()) {
throw new \RuntimeException($this->process->getOutput());
throw new \RuntimeException($this->getOutput());
}
}

Expand Down

0 comments on commit 8d3b0ad

Please sign in to comment.