Commit f60eeee9 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-21062 Do not use popen() in text mode for mysql_upgrade.

parent 9d4da685
...@@ -383,11 +383,20 @@ static int run_command(char* cmd, ...@@ -383,11 +383,20 @@ static int run_command(char* cmd,
if (opt_verbose >= 4) if (opt_verbose >= 4)
puts(cmd); puts(cmd);
if (!(res_file= my_popen(cmd, IF_WIN("rt","r")))) if (!(res_file= my_popen(cmd, "r")))
die("popen(\"%s\", \"r\") failed", cmd); die("popen(\"%s\", \"r\") failed", cmd);
while (fgets(buf, sizeof(buf), res_file)) while (fgets(buf, sizeof(buf), res_file))
{ {
#ifdef _WIN32
/* Strip '\r' off newlines. */
size_t len = strlen(buf);
if (len > 1 && buf[len - 2] == '\r' && buf[len - 1] == '\n')
{
buf[len - 2] = '\n';
buf[len - 1] = 0;
}
#endif
DBUG_PRINT("info", ("buf: %s", buf)); DBUG_PRINT("info", ("buf: %s", buf));
if(ds_res) if(ds_res)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment