Redirecting console outputat 2009-07-12 in Examples by friebe (0 comments) To capture output written by any of the PHP functions the ouput control functions can be used (ob_start(), ob_get_contents() and friends). These functions do not affect the output made by the util.cmd.Console class as this writes directly to the standard out and error streams. To redirect these, you can use the following:// Save original stream in variable, change output stream to $stream This can be useful in unittests, when running command line applications inside a web container or inside GUIs, or whatever other usecase you can invent |
|