Latest bnd code
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1350613 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/CommandResource.java b/bundleplugin/src/main/java/aQute/lib/osgi/CommandResource.java
index c9e3c8a..0fa43fe 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/CommandResource.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/CommandResource.java
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-
package aQute.lib.osgi;
import java.io.*;
@@ -22,10 +21,10 @@
import aQute.libg.command.*;
public class CommandResource extends WriteResource {
- final long lastModified;
- final Builder domain;
- final String command;
-
+ final long lastModified;
+ final Builder domain;
+ final String command;
+
public CommandResource(String command, Builder domain, long lastModified) {
this.lastModified = lastModified;
this.domain = domain;
@@ -38,25 +37,26 @@
StringBuilder stdout = new StringBuilder();
try {
domain.trace("executing command %s", command);
- Command cmd = new Command("sh -l");
+ Command cmd = new Command("sh");
cmd.inherit();
String oldpath = cmd.var("PATH");
-
+
String path = domain.getProperty("-PATH");
if (path != null) {
- path = path.replaceAll("\\s*,\\s*",File.pathSeparator);
+ path = path.replaceAll("\\s*,\\s*", File.pathSeparator);
path = path.replaceAll("\\$\\{@\\}", oldpath);
cmd.var("PATH", path);
domain.trace("PATH: %s", path);
}
OutputStreamWriter osw = new OutputStreamWriter(out);
- int result = cmd.execute(command,stdout, errors);
+ int result = cmd.execute(command, stdout, errors);
osw.append(stdout);
osw.flush();
- if ( result != 0) {
+ if (result != 0) {
domain.error("executing command failed %s %s", command, stdout + "\n" + errors);
}
- } catch( Exception e) {
+ }
+ catch (Exception e) {
domain.error("executing command failed %s %s", command, e.getMessage());
}
}