summaryrefslogtreecommitdiff
path: root/client/mysqltest.c
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2006-03-02 16:28:45 +0100
committerunknown <msvensson@neptunus.(none)>2006-03-02 16:28:45 +0100
commit5ab7e8e7adc3cadaad23f7afa3422b4abc6f4eb7 (patch)
tree9a14686255e63bb1a3705559f876951150130d16 /client/mysqltest.c
parente521cb770ac2f854d409f8ddda5ec25eef247b6b (diff)
downloadmariadb-git-5ab7e8e7adc3cadaad23f7afa3422b4abc6f4eb7.tar.gz
Make the "system" command become executed in a bash shell in cygwin.
client/mysqltest.c: Prepend the command to execute by system with "sh" to make it executed by cygwin's bash mysql-test/t/mysqldump.test: Change from " to ' to avoid bash's filename expanding. I.e to avoid that "[mysqltest1]" will be llok for any dirs in mysql-test/* that are named m, y, s, q etc. And ther is actually one dir called t, so we will get a match and thus echo "t" to the file.
Diffstat (limited to 'client/mysqltest.c')
-rw-r--r--client/mysqltest.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 5dd2f5dc65e..a039d970b18 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -1367,7 +1367,9 @@ int do_modify_var(struct st_query *query, const char *name,
NOTE
If mysqltest is executed from cygwin shell, the command will be
- executed in cygwin shell. Thus commands like "rm" etc can be used.
+ executed in the "windows command interpreter" cmd.exe and we prepend "sh"
+ to make it be executed by cygwins "bash". Thus commands like "rm",
+ "mkdir" as well as shellscripts can executed by "system" in Windows.
*/
int do_system(struct st_query *command)
@@ -1379,9 +1381,18 @@ int do_system(struct st_query *command)
init_dynamic_string(&ds_cmd, 0, strlen(command->first_argument) + 64, 256);
+#ifdef __WIN__
+ /* Execute the command in "bash", ie. sh -c "<command>" */
+ dynstr_append(&ds_cmd, "sh -c \"");
+#endif
+
/* Eval the system command, thus replacing all environment variables */
do_eval(&ds_cmd, command->first_argument, TRUE);
+#ifdef __WIN__
+ dynstr_append(&ds_cmd, "\"");
+#endif
+
DBUG_PRINT("info", ("running system command '%s' as '%s'",
command->first_argument, ds_cmd.str));
if (system(ds_cmd.str))