diff options
Diffstat (limited to 'api')
-rw-r--r-- | api/src/main/java/org/openslx/taskmanager/api/SystemCommandTask.java | 10 |
1 files changed, 10 insertions, 0 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() |