summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Black <daniel@mariadb.org>2022-12-14 10:07:56 +1100
committerDaniel Black <daniel@mariadb.org>2022-12-14 10:07:56 +1100
commit12d7a5a09670b5b0c2dd9c233af5af440823c8b3 (patch)
tree9ffd1c6c947fa70b9b639ce862c8bae9860aa775
parent1dc2f35598193fc52b79061c286b61f01c617374 (diff)
downloadmariadb-git-bb-10.5-danielblack-MDEV-30222-mysqltest-popen-err-display.tar.gz
MDEV-30222: display errno for popen failuresbb-10.5-danielblack-MDEV-30222-mysqltest-popen-err-display
-rw-r--r--client/mysqltest.cc22
1 files changed, 18 insertions, 4 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 636ab06d745..df36020c419 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -1795,7 +1795,10 @@ static int run_command(char* cmd,
if (!(res_file= my_popen(cmd, "r")))
{
- report_or_die("popen(\"%s\", \"r\") failed", cmd);
+#ifdef _WIN32
+ my_osmaperr(GetLastError());
+#endif
+ report_or_die("popen(\"%s\", \"r\") failed (errno %d)", cmd, errno);
DBUG_RETURN(-1);
}
@@ -1896,7 +1899,12 @@ static int diff_check(const char *diff_name)
my_snprintf(buf, sizeof(buf), "%s -v", diff_name);
if (!(res_file= my_popen(buf, "r")))
- die("popen(\"%s\", \"r\") failed", buf);
+ {
+#ifdef _WIN32
+ my_osmaperr(GetLastError());
+#endif
+ die("popen(\"%s\", \"r\") failed (errno %d)", buf, errno);
+ }
/*
if diff is not present, nothing will be in stdout to increment
@@ -3355,9 +3363,12 @@ void do_exec(struct st_command *command)
if (!(res_file= my_popen(ds_cmd.str, "r")))
{
+#ifdef _WIN32
+ my_osmaperr(GetLastError());
+#endif
dynstr_free(&ds_cmd);
if (command->abort_on_error)
- report_or_die("popen(\"%s\", \"r\") failed", command->first_argument);
+ report_or_die("popen(\"%s\", \"r\") failed (errno %d)", command->first_argument, errno);
DBUG_VOID_RETURN;
}
@@ -4575,8 +4586,11 @@ void do_perl(struct st_command *command)
if (!(res_file= my_popen(buf, "r")))
{
+#ifdef _WIN32
+ my_osmaperr(GetLastError());
+#endif
if (command->abort_on_error)
- die("popen(\"%s\", \"r\") failed", buf);
+ die("popen(\"%s\", \"r\") failed (errno %d)", buf, errno);
dynstr_free(&ds_delimiter);
DBUG_VOID_RETURN;
}