Craur icon indicating copy to clipboard operation
Craur copied to clipboard

use stderr for error messages in cli

Open DracoBlue opened this issue 13 years ago • 1 comments

ini_set('display_errors', 'STDERR'); redirects exceptions and such to stderr without polluting the stdout

DracoBlue avatar May 30 '12 12:05 DracoBlue

"Although display_errors may be set at runtime (with ini_set()), it won't have any affect if the script has fatal errors. This is because the desired runtime action does not get executed."

http://us3.php.net/manual/en/errorfunc.configuration.php#ini.display-errors

Tried it with some "unexpected" exception and shell exit code was 255, but 2>/dev/null redirection did not work. Needs investigation. At least exceptions can be catched and then a default error message to stderr with exit code may be presented to the user... :-)

graste avatar Feb 06 '13 22:02 graste