Correct aapt/aapt2 waiting too long on execution output (#3071)

Co-authored-by: Connor Tumbleson <iBotPeaches@users.noreply.github.com>
This commit is contained in:
sv99 2023-05-20 21:01:03 +03:00 committed by GitHub
parent 80dcdd1d34
commit b83b58e8e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -120,12 +120,10 @@ public class OS {
StreamCollector collector = new StreamCollector(process.getInputStream()); StreamCollector collector = new StreamCollector(process.getInputStream());
executor.execute(collector); executor.execute(collector);
process.waitFor(); process.waitFor(15, TimeUnit.SECONDS);
if (! executor.awaitTermination(15, TimeUnit.SECONDS)) { executor.shutdownNow();
executor.shutdownNow(); if (! executor.awaitTermination(5, TimeUnit.SECONDS)) {
if (! executor.awaitTermination(5, TimeUnit.SECONDS)) { System.err.println("Stream collector did not terminate.");
System.err.println("Stream collector did not terminate.");
}
} }
return collector.get(); return collector.get();
} catch (IOException | InterruptedException e) { } catch (IOException | InterruptedException e) {