summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose Miguel Pérez Ruiz <josemiguel@perezruiz.com>2014-04-27 01:34:03 +0200
committerJose Miguel Pérez Ruiz <josemiguel@perezruiz.com>2014-04-27 01:34:03 +0200
commit190e968360cfd2bb12ecfd75a5653d186862011b (patch)
tree399e7c5d1f002183fe8f7df3221df152e4e21763
parentf69116c1ee223808318ccf2bc8a34026116e3706 (diff)
downloadansicolors-origin/master.zip
ansicolors-origin/master.tar.gz
ansicolors-origin/master.tar.bz2
Define constant 'STDOUT' if not already defined.HEAD1.0.1origin/masterorigin/HEADmaster
-rw-r--r--lib/ansi.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/ansi.php b/lib/ansi.php
index a5d3e0c..350ac50 100644
--- a/lib/ansi.php
+++ b/lib/ansi.php
@@ -29,6 +29,18 @@
*/
/**
+ * Define STDOUT constant. STDOUT as constant should be automatically defined
+ * in CLI mode but is not in the interactive mode of the php executable by
+ * using "php -a" in the shell.
+ *
+ * Despite the huge amount of comments elsewhere, the "stdout" standard output
+ * stream is just the file handle of "1". "php://stdout" is just syntactic
+ * sugar to open the same, but file handle 1 should be already opened.
+ *
+ */
+if (!defined("STDOUT")) define("STDOUT", 1);
+
+/**
* Main "ansi" class. Defined in the root namespace to be able to use it as
* static class. Just imagine it is a namespace...
*