error handling is your friend
authorRiver Tarnell <kateturner@users.mediawiki.org>
Thu, 7 Jul 2005 02:29:55 +0000 (02:29 +0000)
committerRiver Tarnell <kateturner@users.mediawiki.org>
Thu, 7 Jul 2005 02:29:55 +0000 (02:29 +0000)
install-utils.inc
maintenance/mcc.php

index 913dae5..2846fca 100644 (file)
@@ -62,7 +62,9 @@ function readconsole( $prompt = '' ) {
        } else {
                print $prompt;
                $fp = fopen( 'php://stdin', 'r' );
-               $resp = trim( fgets( $fp, 1024 ) );
+               $st = fgets($fp, 1024);
+               if ($st === false) return false;
+               $resp = trim( $st ) );
                fclose( $fp );
                return $resp;
        }
index b7697c7..73b03a1 100755 (executable)
@@ -19,6 +19,7 @@ do {
        $bad = false;
        $quit = false;
        $line = readconsole( "> " );
+       if ($line === false) exit;
        $args = explode( " ", $line );
        $command = array_shift( $args );
        switch ( $command ) {