summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2018-03-20 12:40:24 +0100
committerSimon Rettberg2018-03-20 12:40:24 +0100
commit3950def62b4225e40d5a3c9df7a8c44171a9325f (patch)
tree33539041ed882ed098898f3a544e3d523dd5965b
parent[SystemCommandTask] try-with for stdout/err readers, close input after done (diff)
downloadtaskman-lite-3950def62b4225e40d5a3c9df7a8c44171a9325f.tar.gz
taskman-lite-3950def62b4225e40d5a3c9df7a8c44171a9325f.tar.xz
taskman-lite-3950def62b4225e40d5a3c9df7a8c44171a9325f.zip
[SystemCommandTask] Support changing environment
-rw-r--r--api/src/main/java/org/openslx/taskmanager/api/SystemCommandTask.java10
-rw-r--r--daemon/pom.xml2
-rw-r--r--pom.xml2
3 files changed, 12 insertions, 2 deletions
diff --git a/api/src/main/java/org/openslx/taskmanager/api/SystemCommandTask.java b/api/src/main/java/org/openslx/taskmanager/api/SystemCommandTask.java
index 3e480de..18c8ecc 100644
--- a/api/src/main/java/org/openslx/taskmanager/api/SystemCommandTask.java
+++ b/api/src/main/java/org/openslx/taskmanager/api/SystemCommandTask.java
@@ -6,6 +6,7 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
+import java.util.Map;
import org.apache.log4j.Logger;
@@ -47,6 +48,7 @@ public abstract class SystemCommandTask extends AbstractTask
ProcessBuilder pb = new ProcessBuilder( command );
pb.directory( new File( "/" ) );
+ initEnvironment( pb.environment() );
try {
@@ -208,6 +210,14 @@ public abstract class SystemCommandTask extends AbstractTask
protected abstract String[] initCommandLine();
/**
+ * Override this to modify the environment of the process to be started.
+ * @param environment
+ */
+ protected void initEnvironment( Map<String, String> environment )
+ {
+ }
+
+ /**
* Called when the process has been successfully started.
*/
protected void processStarted()
diff --git a/daemon/pom.xml b/daemon/pom.xml
index f25d610..0d75e1a 100644
--- a/daemon/pom.xml
+++ b/daemon/pom.xml
@@ -17,7 +17,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>3.1</version>
+ <version>3.6.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
diff --git a/pom.xml b/pom.xml
index c07ee72..64bafdb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>3.1</version>
+ <version>3.6.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>