mirror of
https://github.com/revanced/Apktool.git
synced 2024-12-04 18:12:54 +01:00
fix: make sure we wait on executor for output
- fixes: #1809 - thanks to sunshouxiang
This commit is contained in:
parent
6460fde436
commit
6231edfcfd
@ -21,6 +21,7 @@ import java.io.*;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
@ -113,6 +114,12 @@ public class OS {
|
|||||||
executor.execute(collector);
|
executor.execute(collector);
|
||||||
|
|
||||||
process.waitFor();
|
process.waitFor();
|
||||||
|
if (! executor.awaitTermination(15, TimeUnit.SECONDS)) {
|
||||||
|
executor.shutdownNow();
|
||||||
|
if (! executor.awaitTermination(5, TimeUnit.SECONDS)) {
|
||||||
|
System.err.println("Stream collector did not terminate.");
|
||||||
|
}
|
||||||
|
}
|
||||||
return collector.get();
|
return collector.get();
|
||||||
} catch (IOException | InterruptedException e) {
|
} catch (IOException | InterruptedException e) {
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user