Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53b3bb07 authored by Guang Zhu's avatar Guang Zhu Committed by Android (Google) Code Review
Browse files

Merge "clean up Process instance after we are done with the sub process" into mnc-dev

parents 2d144063 843b992b
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -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);
                }