FS: Open TemporaryBuffer in try-with-resource
Change-Id: I52e048e491e838b7f762a5b5f4d148e91049877c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
parent
ae1a53a148
commit
fabd645fad
|
@ -1227,14 +1227,11 @@ private static boolean shutdownAndAwaitTermination(ExecutorService pool) {
|
||||||
*/
|
*/
|
||||||
public ExecutionResult execute(ProcessBuilder pb, InputStream in)
|
public ExecutionResult execute(ProcessBuilder pb, InputStream in)
|
||||||
throws IOException, InterruptedException {
|
throws IOException, InterruptedException {
|
||||||
TemporaryBuffer stdout = new TemporaryBuffer.LocalFile(null);
|
try (TemporaryBuffer stdout = new TemporaryBuffer.LocalFile(null);
|
||||||
TemporaryBuffer stderr = new TemporaryBuffer.Heap(1024, 1024 * 1024);
|
TemporaryBuffer stderr = new TemporaryBuffer.Heap(1024,
|
||||||
try {
|
1024 * 1024)) {
|
||||||
int rc = runProcess(pb, stdout, stderr, in);
|
int rc = runProcess(pb, stdout, stderr, in);
|
||||||
return new ExecutionResult(stdout, stderr, rc);
|
return new ExecutionResult(stdout, stderr, rc);
|
||||||
} finally {
|
|
||||||
stdout.close();
|
|
||||||
stderr.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue