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

Print fatal errors to STDERR (fixes #61) #62

Merged
merged 1 commit into from Jun 22, 2016
Merged
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
12 changes: 6 additions & 6 deletions lib/phake/Bin.php
Expand Up @@ -138,23 +138,23 @@ private function detect_and_display_cycles($application) {

private function fatal($exception, $message = null, $trace = false) {

echo "aborted!\n";
fwrite(STDERR, "aborted!\n");

if (!$message) $message = $exception->getMessage();
if (!$message) $message = get_class($exception);

if (Utils::is_tty()) {
echo "\033[0;31m{$message}\033[0m";
fwrite(STDERR, "\033[0;31m{$message}\033[0m");
} else {
echo $message;
fwrite(STDERR, $message);
}

echo "\n\n";
fwrite(STDERR, "\n\n");

if ($trace) {
echo $exception->getTraceAsString() . "\n";
fwrite(STDERR, $exception->getTraceAsString() . "\n");
} else {
echo "(See full trace by running task with --trace)\n";
fwrite(STDERR, "(See full trace by running task with --trace)\n");
}

die(1);
Expand Down