Skip to content

Instantly share code, notes, and snippets.

@gargoyle
Created September 6, 2013 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gargoyle/6463200 to your computer and use it in GitHub Desktop.
Save gargoyle/6463200 to your computer and use it in GitHub Desktop.
<?php
/**
* Sets the stdout and stderr streams if they are not already set.
*/
private static function initializeOutputStreams() {
if (self::$out === null) {
if (!defined('STDOUT')) {
self::$out = new OutputStream(fopen('php://stdout', 'w'));
} else {
self::$out = new OutputStream(STDOUT);
}
}
if (self::$err === null) {
if (!defined('STDERR')) {
self::$out = new OutputStream(fopen('php://stderr', 'w'));
} else {
self::$err = new OutputStream(STDERR);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment