Browse Source

Don't hardcode /usr/bin/env for Unix.

PR: 17642


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274375 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
006b093ab2
2 changed files with 19 additions and 12 deletions
  1. +4
    -1
      WHATSNEW
  2. +15
    -11
      src/main/org/apache/tools/ant/taskdefs/Execute.java

+ 4
- 1
WHATSNEW View File

@@ -79,6 +79,9 @@ Fixed bugs:
* <antlr> will now recompile your grammar if the supergrammar has
changed. Bugzilla Report 12691.

* <property env> will now work on Unices with /bin/env instead of
/usr/bin/env. Bugzilla Report 17642.

Other changes:
--------------
* Shipped XML parser is now Xerces 2.4.0
@@ -145,7 +148,7 @@ Other changes:
* <tarfileset> has a new dirmode attribute to specify the permissions
for directories.

* <fixcrlf>'s eol attribute now also understand "mac", "unix" and "dos".
* <fixcrlf>'s eol attribute now also understands "mac", "unix" and "dos".

* <classfileset> now picks up dependencies of the form MyClass.class. This
works for the code generated by the Sun java compiler. It may not work for


+ 15
- 11
src/main/org/apache/tools/ant/taskdefs/Execute.java View File

@@ -229,19 +229,23 @@ public class Execute {
String[] cmd = {"command.com", "/c", "set" };
return cmd;
}
} else if (Os.isFamily("z/os")) {
String[] cmd = {"/bin/env"};
return cmd;
} else if (Os.isFamily("tandem")) {
// String[] cmd = {"/bin/sh -c env"};
String[] cmd = {"/bin/env"};
return cmd;
} else if (Os.isFamily("unix")) {
// Generic UNIX
// Alternatively one could use: /bin/sh -c env
String[] cmd = {"/usr/bin/env"};
} else if (Os.isFamily("z/os") || Os.isFamily("tandem")
|| Os.isFamily("unix")) {
// On most systems one could use: /bin/sh -c env

// Some systems have /bin/env, others /usr/bin/env, just try
String[] cmd = new String[1];
if (new File("/bin/env").canRead()) {
cmd[0] = "/bin/env";
} else if (new File("/usr/bin/env").canRead()) {
cmd[0] = "/usr/bin/env";
} else {
// rely on PATH
cmd[0] = "env";
}
return cmd;
} else if (Os.isFamily("netware") || Os.isFamily("os/400")) {
// rely on PATH
String[] cmd = {"env"};
return cmd;
} else {


Loading…
Cancel
Save