From 6df0bb7d382fa7a6043fc7e9587889d3b53976b7 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 13 Nov 2019 21:12:48 +0100 Subject: MDEV-21062 Buildbot, Windows - sporadically missing lines from mtr's "exec" Provide own version of popen/pclose, in attempt to workaround sporadic erratic behavior of UCRT's one. --- client/mysql_upgrade.c | 4 ++-- client/mysqltest.cc | 14 +++----------- 2 files changed, 5 insertions(+), 13 deletions(-) (limited to 'client') diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 39fe715bdff..85722343388 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -383,7 +383,7 @@ static int run_command(char* cmd, if (opt_verbose >= 4) puts(cmd); - if (!(res_file= popen(cmd, "r"))) + if (!(res_file= my_popen(cmd, IF_WIN("rt","r")))) die("popen(\"%s\", \"r\") failed", cmd); while (fgets(buf, sizeof(buf), res_file)) @@ -401,7 +401,7 @@ static int run_command(char* cmd, } } - error= pclose(res_file); + error= my_pclose(res_file); return WEXITSTATUS(error); } diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 3e61b2ec9b7..bb59e5fd42f 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -872,14 +872,6 @@ static char *my_fgets(char * s, int n, FILE * stream, int *len) return buf; } -/* - Wrapper for popen(). -*/ -static FILE* my_popen(const char *cmd, const char *mode) -{ - return popen(cmd, mode); -} - #ifdef EMBEDDED_LIBRARY #define EMB_SEND_QUERY 1 @@ -1854,7 +1846,7 @@ static int run_command(char* cmd, } } - error= pclose(res_file); + error= my_pclose(res_file); DBUG_RETURN(WEXITSTATUS(error)); } @@ -3440,7 +3432,7 @@ void do_exec(struct st_command *command) { replace_dynstr_append_mem(ds_result, buf, len); } - error= pclose(res_file); + error= my_pclose(res_file); if (display_result_sorted) { @@ -4670,7 +4662,7 @@ void do_perl(struct st_command *command) replace_dynstr_append_mem(&ds_res, buf, len); } } - error= pclose(res_file); + error= my_pclose(res_file); /* Remove the temporary file, but keep it if perl failed */ if (!error) -- cgit v1.2.1