summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--framework/src/main/java/org/onap/cli/fw/utils/ProcessRunner.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/utils/ProcessRunner.java b/framework/src/main/java/org/onap/cli/fw/utils/ProcessRunner.java
index ff9d5520..c0a910cf 100644
--- a/framework/src/main/java/org/onap/cli/fw/utils/ProcessRunner.java
+++ b/framework/src/main/java/org/onap/cli/fw/utils/ProcessRunner.java
@@ -92,13 +92,17 @@ public class ProcessRunner {
public void run() throws InterruptedException, IOException {
Process p = null;
+ File workingDirectory = null;
+ if (cwd != null) {
+ workingDirectory = new File(cwd);
+ }
if (this.cmd.length == 1) {
- p = Runtime.getRuntime().exec(this.shell + this.cmd[0], this.env, null);
+ p = Runtime.getRuntime().exec(this.shell + this.cmd[0], this.env, workingDirectory);
} else {
List list = new ArrayList(Arrays.asList(this.shell.split(" ")));
list.addAll(Arrays.asList(this.cmd));
String []cmds = Arrays.copyOf(list.toArray(), list.size(), String[].class);
- p = Runtime.getRuntime().exec(cmds, this.env, null);
+ p = Runtime.getRuntime().exec(cmds, this.env, workingDirectory);
}
boolean readOutput = false;