In a groovy script I execute an application on linux and windows with:
def proc = command.execute()
proc.consumeProcessOutput( System.out, System.err)
println "here"
proc.waitFor()
println "never here"
but the waitFor() call never returns. The strange thing is that it only happens on linux.
Based on this: process.waitFor() never returns
it could be caused by not reading from the appropriate streams. But as you can see I consume both System.out, System.err. Are there other streams that could be consumed?
I also had similar problem and the process being run was only hanging on jenkins
CI server. It was a plutil
command and consumeProcessOutputStream
method was used.
Since there I use ProcessBuilder
to construct and run processes.
def processBuilder = new ProcessBuilder('some command')
processBuilder.directory(new File('some dir')).environment().putAll([:])
processBuilder.redirectOutput(new File('out'))
processBuilder.redirectError(new File('err'))
Unfortunately no idea what causes Your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With