Currently, running admin/cli/upgrade.php when no upgrade is required will exit with status 0 (since this is considered a success), but then it outputs a message to stderr. This makes it difficult to differentiate between this case and genuine error conditions (e.g. if Moodle cannot connect to the database, it will also exit with status 0 and output to stderr).
I don't think this was done intentionally, the cli_error() function was probably used to as it conveniently exits the script for you with a given exit code, outputting the message to stderr was probably a side effect.
Before I offer a fix for this that sends the message to stdout instead, is anyone using this script in a way that changing this will cause big problems?
I have filed this on the tracker: MDL-62644