File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 179179 install_mysql_db_lower_than_8_0
180180fi
181181
182- echo " Succesfully prepared the database for running tests."
182+ echo " Successfully prepared the database for running tests."
183183echo " This command does not have to be run again."
Original file line number Diff line number Diff line change @@ -43,10 +43,12 @@ function version_tags(
4343function get_db_type_and_version () {
4444 // Detect which client binary is available.
4545 $ client_binary = null ;
46+ $ output = array ();
4647 exec ( 'command -v mysql 2>/dev/null ' , $ output , $ mysql_exit_code );
4748 if ( 0 === $ mysql_exit_code ) {
4849 $ client_binary = 'mysql ' ;
4950 } else {
51+ $ output = array ();
5052 exec ( 'command -v mariadb 2>/dev/null ' , $ output , $ mariadb_exit_code );
5153 if ( 0 === $ mariadb_exit_code ) {
5254 $ client_binary = 'mariadb ' ;
@@ -88,7 +90,15 @@ function get_db_type_and_version() {
8890 $ pass_arg
8991 );
9092
91- $ version_string = exec ( $ cmd );
93+ $ output = array ();
94+ $ return_code = 0 ;
95+ exec ( $ cmd , $ output , $ return_code );
96+ $ version_string = isset ( $ output [0 ] ) ? $ output [0 ] : '' ;
97+
98+ // If the connection failed, return defaults.
99+ if ( 0 !== $ return_code || empty ( $ version_string ) ) {
100+ return array ( 'type ' => 'mysql ' , 'version ' => '' );
101+ }
92102
93103 // Detect database type from server version string.
94104 $ db_type = 'mysql ' ;
You can’t perform that action at this time.
0 commit comments