From d28d91e6cdf3f530ffadfd81a77f2371735f8569 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Wed, 17 Jan 2018 18:24:34 -0800 Subject: [PATCH] Convert Maintenance to the new shell framework Change-Id: Ibec8a84071fdf061f9831b2964143d99464cd4cc --- maintenance/Maintenance.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 0c79bd51e5..4d0af5fa78 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -25,6 +25,7 @@ require_once __DIR__ . '/../includes/PHPVersionCheck.php'; wfEntryPointCheck( 'cli' ); +use MediaWiki\Shell\Shell; use Wikimedia\Rdbms\DBReplicationWaitError; /** @@ -1592,12 +1593,12 @@ abstract class Maintenance { // something that can do the relevant syscalls. There are a few // options. Linux and Mac OS X both have "stty size" which does the // job directly. - $retval = false; - $size = wfShellExec( 'stty size', $retval ); - if ( $retval !== 0 ) { + $result = Shell::command( 'stty', 'size' ) + ->execute(); + if ( $result->getExitCode() !== 0 ) { return $default; } - if ( !preg_match( '/^(\d+) (\d+)$/', $size, $m ) ) { + if ( !preg_match( '/^(\d+) (\d+)$/', $result->getStdout(), $m ) ) { return $default; } return [ intval( $m[2] ), intval( $m[1] ) ]; -- 2.20.1