Skip to content

Commit

Permalink
Restore lost PATH lookup during executable search. Fixes #4809.
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Mar 22, 2018
1 parent 807900a commit b0f7aaf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/src/main/java/org/jruby/util/ShellLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,16 @@ public static File findPathExecutable(Ruby runtime, String fname) {
// MRI: Hopefully close to dln_find_exe_r used by popen logic
public static File findPathExecutable(Ruby runtime, String fname, IRubyObject pathObject) {
String[] pathNodes;

if (pathObject == null || pathObject.isNil()) {
RubyHash env = (RubyHash) runtime.getObject().getConstant("ENV");
pathObject = env.op_aref(runtime.getCurrentContext(), RubyString.newString(runtime, PATH_ENV));
}

if (pathObject == null) {
pathNodes = DEFAULT_PATH; // ASSUME: not modified by callee
}

else {
String pathSeparator = System.getProperty("path.separator");
String path = pathObject.toString();
Expand Down

0 comments on commit b0f7aaf

Please sign in to comment.