diff options
Diffstat (limited to 'api/src')
-rw-r--r-- | api/src/main/java/org/openslx/taskmanager/api/SystemCommandTask.java | 10 |
1 files changed, 6 insertions, 4 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 2f3cf57..3e480de 100644 --- a/api/src/main/java/org/openslx/taskmanager/api/SystemCommandTask.java +++ b/api/src/main/java/org/openslx/taskmanager/api/SystemCommandTask.java @@ -67,8 +67,7 @@ public abstract class SystemCommandTask extends AbstractTask @Override public void run() { - try { - BufferedReader reader = new BufferedReader( new InputStreamReader( p.getInputStream() ) ); + try ( BufferedReader reader = new BufferedReader( new InputStreamReader( p.getInputStream() ) ) ) { String line; while ( ( line = reader.readLine() ) != null ) { synchronized ( p ) { @@ -85,8 +84,7 @@ public abstract class SystemCommandTask extends AbstractTask @Override public void run() { - try { - BufferedReader reader = new BufferedReader( new InputStreamReader( p.getErrorStream() ) ); + try ( BufferedReader reader = new BufferedReader( new InputStreamReader( p.getErrorStream() ) ) ) { String line; while ( ( line = reader.readLine() ) != null ) { synchronized ( p ) { @@ -135,6 +133,10 @@ public abstract class SystemCommandTask extends AbstractTask process.getOutputStream().close(); } catch ( Throwable t ) { } + try { + process.getInputStream().close(); + } catch ( Throwable t ) { + } synchronized ( p ) { return processEnded( retval ); |