From 4821afd42507329fa0755b26b85c8135f8052435 Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Wed, 8 Jul 2020 18:05:45 +0200 Subject: [PATCH] Use MySQL binary in interactive mode for db cli command --- src/DB_Command.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/DB_Command.php b/src/DB_Command.php index ef6c3285f..9b5b338bb 100644 --- a/src/DB_Command.php +++ b/src/DB_Command.php @@ -367,7 +367,7 @@ public function cli( $_, $assoc_args ) { } WP_CLI::debug( 'Associative arguments: ' . json_encode( $assoc_args ), 'db' ); - self::run( $command, $assoc_args ); + self::run( $command, $assoc_args, null, true ); } /** @@ -1480,6 +1480,9 @@ protected function run_query( $query, $assoc_args = [] ) { * use. * @param bool $send_to_shell Optional. Whether to send STDOUT and STDERR * immediately to the shell. Defaults to true. + * @param bool $interactive Optional. Whether MySQL is meant to be + * executed as an interactive process. Defaults + * to false. * * @return array { * Associative array containing STDOUT and STDERR output. @@ -1489,7 +1492,7 @@ protected function run_query( $query, $assoc_args = [] ) { * @type int $exit_code Exit code of the process. * } */ - private static function run( $cmd, $assoc_args = [], $send_to_shell = true ) { + private static function run( $cmd, $assoc_args = [], $send_to_shell = true, $interactive = false ) { $required = [ 'host' => DB_HOST, 'user' => DB_USER, @@ -1513,7 +1516,7 @@ private static function run( $cmd, $assoc_args = [], $send_to_shell = true ) { $final_args = array_merge( $assoc_args, $required ); - return Utils\run_mysql_command( $cmd, $final_args, null, $send_to_shell ); + return Utils\run_mysql_command( $cmd, $final_args, null, $send_to_shell, $interactive ); } /**