aboutsummaryrefslogtreecommitdiffstats
path: root/framework
diff options
context:
space:
mode:
authorKanagaraj Manickam <kanagaraj.manickam@huawei.com>2020-02-21 04:56:48 +0000
committerGerrit Code Review <gerrit@onap.org>2020-02-21 04:56:48 +0000
commit544ec09df41122d64081ed9388e1216c70eac769 (patch)
tree69f512075496c5ef66fb04703cbd0820d6d5138b /framework
parentbeb963987501c872b010a0b28249cfb54e46c27b (diff)
parentbe993dd46d6d0e093239cbb9234e586b8c3ae4ee (diff)
Merge "ProcessRunner should use the cwd provided when calling Runtime.exec(...) Issue-ID: VNFSDK-501"
Diffstat (limited to 'framework')
-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;