Skip to content

Commit 95b253c

Browse files
committedFeb 13, 2018
Perform executable search and use shell for bat/cmd. Fixes #5018.
1 parent 131ba02 commit 95b253c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
 

‎core/src/main/java/org/jruby/util/ShellLauncher.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ private static Process popenShared(Ruby runtime, IRubyObject[] strings, Map env,
808808
}
809809

810810
String[] args = parseCommandLine(runtime.getCurrentContext(), runtime, strings);
811-
LaunchConfig lc = new LaunchConfig(runtime, strings, false);
811+
LaunchConfig lc = new LaunchConfig(runtime, strings, true);
812812
boolean useShell = Platform.IS_WINDOWS ? lc.shouldRunInShell() : false;
813813
if (addShell) for (String arg : args) useShell |= shouldUseShell(arg);
814814

@@ -1147,11 +1147,11 @@ public boolean shouldRunInShell() {
11471147
// if the executable exists, start it directly with no shell
11481148
if (executableFile != null) {
11491149
log(runtime, "Got it: " + executableFile);
1150-
// TODO: special processing for BAT/CMD files needed at all?
1151-
// if (isBatch(executableFile)) {
1152-
// log(runtime, "This is a BAT/CMD file, will start in shell");
1153-
// return true;
1154-
// }
1150+
// Windows will not launch bat/cmd files directly, so use subshell
1151+
if (isBatch(executableFile)) {
1152+
log(runtime, "This is a BAT/CMD file, will start in shell");
1153+
return true;
1154+
}
11551155
return false;
11561156
} else {
11571157
log(runtime, "Didn't find executable: " + executable);

0 commit comments

Comments
 (0)
Please sign in to comment.