Created
August 27, 2015 14:26
-
-
Save lucacesari/f3caa3cfb731d3a8abd0 to your computer and use it in GitHub Desktop.
Java Process hanging waitFor() fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Process p = Runtime.getRuntime().exec("my-long-command"); | |
BufferedInputStream in = new BufferedInputStream(process.getInputStream()); | |
byte[] bytes = new byte[4096]; | |
while (in.read(bytes) != -1) {} | |
process.waitFor(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment