PumpStreamHandler can capture the process output in realtime
问题 I try to capture a python process output via apache-commons-exec. But it looks like it won't print the output, the output is only displayed after I the python process is finished. Here's my java code CommandLine cmd = CommandLine.parse("/Users/jzhang/anaconda/bin/python"); cmd.addArgument("/Users/jzhang/a.py"); DefaultExecutor executor = new DefaultExecutor(); ExecuteWatchdog watchDog = new ExecuteWatchdog(ExecuteWatchdog.INFINITE_TIMEOUT); executor.setWatchdog(watchDog); executor.execute(cmd