diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java index b43a7612d..edcb9d7a6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java @@ -1227,14 +1227,11 @@ private static boolean shutdownAndAwaitTermination(ExecutorService pool) { */ public ExecutionResult execute(ProcessBuilder pb, InputStream in) throws IOException, InterruptedException { - TemporaryBuffer stdout = new TemporaryBuffer.LocalFile(null); - TemporaryBuffer stderr = new TemporaryBuffer.Heap(1024, 1024 * 1024); - try { + try (TemporaryBuffer stdout = new TemporaryBuffer.LocalFile(null); + TemporaryBuffer stderr = new TemporaryBuffer.Heap(1024, + 1024 * 1024)) { int rc = runProcess(pb, stdout, stderr, in); return new ExecutionResult(stdout, stderr, rc); - } finally { - stdout.close(); - stderr.close(); } }