Skip to content

Commit b0f7aaf

Browse files
committedMar 22, 2018
Restore lost PATH lookup during executable search. Fixes #4809.
1 parent 807900a commit b0f7aaf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
 

Diff for: ‎core/src/main/java/org/jruby/util/ShellLauncher.java

+7
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,16 @@ public static File findPathExecutable(Ruby runtime, String fname) {
420420
// MRI: Hopefully close to dln_find_exe_r used by popen logic
421421
public static File findPathExecutable(Ruby runtime, String fname, IRubyObject pathObject) {
422422
String[] pathNodes;
423+
423424
if (pathObject == null || pathObject.isNil()) {
425+
RubyHash env = (RubyHash) runtime.getObject().getConstant("ENV");
426+
pathObject = env.op_aref(runtime.getCurrentContext(), RubyString.newString(runtime, PATH_ENV));
427+
}
428+
429+
if (pathObject == null) {
424430
pathNodes = DEFAULT_PATH; // ASSUME: not modified by callee
425431
}
432+
426433
else {
427434
String pathSeparator = System.getProperty("path.separator");
428435
String path = pathObject.toString();

0 commit comments

Comments
 (0)
Please sign in to comment.