Hoo man has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/382181 )

Change subject: CLI: Make sure we don't exit with 0 when an exception is 
encountered
......................................................................

CLI: Make sure we don't exit with 0 when an exception is encountered

I registered the additional shutdown function for CLI only
as it shouldn't have effect otherwise.

Bug: T177414
Change-Id: I440d294eef5e307743cfc7f5ab3b531e8c973873
---
M includes/exception/MWExceptionHandler.php
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/81/382181/1

diff --git a/includes/exception/MWExceptionHandler.php 
b/includes/exception/MWExceptionHandler.php
index a2ec391..3fa3232 100644
--- a/includes/exception/MWExceptionHandler.php
+++ b/includes/exception/MWExceptionHandler.php
@@ -128,6 +128,15 @@
        public static function handleException( $e ) {
                self::rollbackMasterChangesAndLog( $e );
                self::report( $e );
+
+               // Make sure we don't claim success on exit for CLI scripts 
(T177414)
+               if ( isset( $GLOBALS['wgCommandLineMode'] ) && 
$GLOBALS['wgCommandLineMode'] ) {
+                       register_shutdown_function(
+                               function() {
+                                       exit( 255 );
+                               }
+                       );
+               }
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/382181
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I440d294eef5e307743cfc7f5ab3b531e8c973873
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to