java.lang.Process.waitFor()

Erik Poupaert erik.poupaert@freestyler-toolkit.org
Sun Sep 28 12:12:00 GMT 2003


When forking a subprocess in gcj, java.lang.Process.waitFor() may return, before I've
finished reading Process.getInputStream() or Process.getErrorStream().
Does anybody know what the appropriate way is to wait for the inputstream-reading
thread to complete? What I do now, is to create a method "finished()" that will only
return true when the Process.getInputStream() is empty:
		while (!threadOut.finished()) 
		{
			Thread.sleep(50);
		}
Is there a better way to do this? I mean with all the monitor/threading
infrastructure available in gcj, the snippet above probably looks rather primitive.
Thanks.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /