summaryrefslogtreecommitdiffstats
path: root/win/tclWinPipe.c
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2018-08-17 18:26:10 (GMT)
committersebres <sebres@users.sourceforge.net>2018-08-17 18:26:10 (GMT)
commitaed158b5189a8d32312907d0c388e7ae9826f92f (patch)
tree81865c7f5e8a5c5761ec480bd3da3353ff5c2ff6 /win/tclWinPipe.c
parentc7cdc550c4e27c7ab0e3d4537cff99167b4509fd (diff)
downloadtcl-aed158b5189a8d32312907d0c388e7ae9826f92f.zip
tcl-aed158b5189a8d32312907d0c388e7ae9826f92f.tar.gz
tcl-aed158b5189a8d32312907d0c388e7ae9826f92f.tar.bz2
win: TclpCreateProcess or [exec process ...] - search for application extended with ".cmd" extension:
automatically tries appending ".com", ".exe", ".bat" and ".cmd", in that order, to the name, looking for an executable. (partially cherry-picked from 8.6 branch)
Diffstat (limited to 'win/tclWinPipe.c')
-rw-r--r--win/tclWinPipe.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index b5f035db..e0d8c63 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.c
@@ -900,7 +900,7 @@ TclpGetPid(
*
* The complete Windows search path is searched to find the specified
* executable. If an executable by the given name is not found,
- * automatically tries appending ".com", ".exe", and ".bat" to the
+ * automatically tries appending ".com", ".exe", ".bat" and ".cmd" to the
* executable name.
*
* Results:
@@ -1369,11 +1369,11 @@ ApplicationType(
Tcl_DString nameBuf, ds;
const TCHAR *nativeName;
WCHAR nativeFullPath[MAX_PATH];
- static const char extensions[][5] = {"", ".com", ".exe", ".bat"};
+ static const char extensions[][5] = {"", ".com", ".exe", ".bat", ".cmd"};
/*
* Look for the program as an external program. First try the name as it
- * is, then try adding .com, .exe, and .bat, in that order, to the name,
+ * is, then try adding .com, .exe, .bat and .cmd, in that order, to the name,
* looking for an executable.
*
* Using the raw SearchPath() function doesn't do quite what is necessary.
@@ -1414,7 +1414,8 @@ ApplicationType(
Tcl_DStringFree(&ds);
ext = strrchr(fullName, '.');
- if ((ext != NULL) && (strcasecmp(ext, ".bat") == 0)) {
+ if ((ext != NULL) &&
+ (strcasecmp(ext, ".cmd") == 0 || strcasecmp(ext, ".bat") == 0)) {
applType = APPL_DOS;
break;
}