Java process.waitFor() returns with inconsistent value

假装没事ソ 提交于 2021-01-29 05:46:55

问题


Use process = Runtime.getRuntime.exec("other.sh") to lauch other.sh who exits with 1, however, process.waitFor() returns with 0. Under Linux RedHat 7.

other.sh just starts another Java process that returns by System.exit(1).

I've seen the same problem in https://coderanch.com/t/326568/java/exitValue-returns-inconsistent-values. However, it said that this was a JDK bug in 1.4 and was fixed already. However, I am using JDK 1.8.

I just want to know if there are any other possibilities leading to such weird behavior? Now our customer and we are both frustrated with this incredible issue.

来源:https://stackoverflow.com/questions/56982666/java-process-waitfor-returns-with-inconsistent-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!