I have the following code snippet:
Process proc = runtime.exec(command);
errorGobbler = new ErrorStreamGobbler(proc.getErrorStream(), logErrors, mdcMap);
outputGobbler = new OutputStreamGobbler(proc.getInputStream(), mdcMap);
executor.execute(errorGobbler);
executor.execute(outputGobbler);
processExitCode = proc.waitFor();
where are the gobblers Runnablethat use BufferedReaderto read input streams and runtime errors. Although this works most of the time, I get a random window (about 2 minutes or so) where I get processExitCodeas 0, which indicates normal completion, but there is nothing in the input and error streams that doesn't even indicate the end of the stream.
As I pointed out earlier, this works most of the time, but this crash happens every time - and I'm completely puzzled. Any ideas?
Rags
source
share