Skip to content

Commit

Permalink
Perform executable search and use shell for bat/cmd. Fixes #5018.
Browse files Browse the repository at this point in the history
headius committed Feb 13, 2018
1 parent 131ba02 commit 95b253c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/src/main/java/org/jruby/util/ShellLauncher.java
Original file line number Diff line number Diff line change
@@ -808,7 +808,7 @@ private static Process popenShared(Ruby runtime, IRubyObject[] strings, Map env,
}

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

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

0 comments on commit 95b253c

Please sign in to comment.