am 53b3bb07: Merge "clean up Process instance after we are done with the sub process" into mnc-dev
* commit '53b3bb072bcebd6b7d89a6b06139f458e9240ae9': clean up Process instance after we are done with the sub process
This commit is contained in:
@@ -239,9 +239,10 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub {
|
||||
public void run() {
|
||||
InputStream in = null;
|
||||
OutputStream out = null;
|
||||
java.lang.Process process = null;
|
||||
|
||||
try {
|
||||
java.lang.Process process = Runtime.getRuntime().exec(command);
|
||||
process = Runtime.getRuntime().exec(command);
|
||||
|
||||
in = process.getInputStream();
|
||||
out = new FileOutputStream(sink.getFileDescriptor());
|
||||
@@ -257,7 +258,9 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub {
|
||||
} catch (IOException ioe) {
|
||||
throw new RuntimeException("Error running shell command", ioe);
|
||||
} finally {
|
||||
IoUtils.closeQuietly(in);
|
||||
if (process != null) {
|
||||
process.destroy();
|
||||
}
|
||||
IoUtils.closeQuietly(out);
|
||||
IoUtils.closeQuietly(sink);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user