aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNoam Postavsky2014-10-25 12:12:01 +0300
committerEli Zaretskii2014-10-25 12:12:01 +0300
commita91ff4f4b1d835cc2c723429c06ddcb357f807c8 (patch)
treef32ac836d8644b60cbd6408acd4de9967c70e53a /src
parentb5dc75aed71ecb2310a6689e2f7082243aa7e4ab (diff)
downloademacs-a91ff4f4b1d835cc2c723429c06ddcb357f807c8.tar.gz
emacs-a91ff4f4b1d835cc2c723429c06ddcb357f807c8.zip
Fix bug #18745 with invoking Windows batch files with embedded whitespace.
src/w32proc.c (create_child): If calling a quoted batch file, pass NULL for exe. nt/cmdproxy.c (batch_file_p): New function. (spawn): If calling a quoted batch file pass NULL for progname. test/automated/process-tests.el (process-test-quoted-batfile): New test.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/w32proc.c10
2 files changed, 15 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a1b70b63755..fb724fb583f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12014-10-25 Noam Postavsky <npostavs@users.sourceforget.net>
2
3 * src/w32proc.c (create_child): If calling a quoted batch file,
4 pass NULL for exe. (Bug#18745)
5
12014-10-24 Eli Zaretskii <eliz@gnu.org> 62014-10-24 Eli Zaretskii <eliz@gnu.org>
2 7
3 * bidi.c (bidi_resolve_explicit, bidi_find_bracket_pairs) 8 * bidi.c (bidi_resolve_explicit, bidi_find_bracket_pairs)
diff --git a/src/w32proc.c b/src/w32proc.c
index 38452917add..09e0c0530a4 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -1078,6 +1078,7 @@ create_child (char *exe, char *cmdline, char *env, int is_gui_app,
1078 DWORD flags; 1078 DWORD flags;
1079 char dir[ MAX_PATH ]; 1079 char dir[ MAX_PATH ];
1080 char *p; 1080 char *p;
1081 const char *ext;
1081 1082
1082 if (cp == NULL) emacs_abort (); 1083 if (cp == NULL) emacs_abort ();
1083 1084
@@ -1116,6 +1117,15 @@ create_child (char *exe, char *cmdline, char *env, int is_gui_app,
1116 if (*p == '/') 1117 if (*p == '/')
1117 *p = '\\'; 1118 *p = '\\';
1118 1119
1120 /* CreateProcess handles batch files as exe specially. This special
1121 handling fails when both the batch file and arguments are quoted.
1122 We pass NULL as exe to avoid the special handling. */
1123 if (exe && cmdline[0] == '"' &&
1124 (ext = strrchr (exe, '.')) &&
1125 (xstrcasecmp (ext, ".bat") == 0
1126 || xstrcasecmp (ext, ".cmd") == 0))
1127 exe = NULL;
1128
1119 flags = (!NILP (Vw32_start_process_share_console) 1129 flags = (!NILP (Vw32_start_process_share_console)
1120 ? CREATE_NEW_PROCESS_GROUP 1130 ? CREATE_NEW_PROCESS_GROUP
1121 : CREATE_NEW_CONSOLE); 1131 : CREATE_NEW_CONSOLE);