aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/main/java/org/onap
diff options
context:
space:
mode:
authorJames Guistwite <jguistwite@iconectiv.com>2019-12-19 14:41:12 -0500
committerJames Guistwite <jguistwite@iconectiv.com>2019-12-19 14:56:49 -0500
commitbe993dd46d6d0e093239cbb9234e586b8c3ae4ee (patch)
tree4c5f01c37fceab7d9e28929d515621bb50b92373 /framework/src/main/java/org/onap
parentd5155b512337ebb873c4c7a5072ef9524b770bc1 (diff)
ProcessRunner should use the cwd provided when calling Runtime.exec(...)
Issue-ID: VNFSDK-501 Signed-off-by: James Guistwite <jguistwite@iconectiv.com> Change-Id: If07360da610b8cc27102801f26502fe2df1004be
Diffstat (limited to 'framework/src/main/java/org/onap')
-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;