Problem:
The following command never finishes when executed from Java: (example using in Groovy)
println "lxc exec example-test -- echo Hi".execute().text
What I have tested:
- Java
Runtime.getRuntime().exec()
also halts when usingprocess.waitFor()
. - Any other command like:
lxc info example-test
, etc. has not problem -
"echo Hi".execute().text
returns ‘Hi’ as expected. - Running the same command from bash returns immediately.
- Interestingly, running it inside perl, the code won’t return unless I press
enter
.
Checking the Java native source code (java.io), it seems that BufferedInputStream.readBytes
its waiting for a termination character that is never returned. However I can see in the buffer the value: “Hi\n” (followed by zeros) just before waiting forever.
Any suggestions on how to debug or make it work?