Assuming that when you crash, you mean that the Java program throws an exception, I would just kill the Python process when that happens. I have not seen your code, but:
class Foo { Process p; private void doStuff() throws Exception { p = Runtime.getRuntime().exec("program.py", envp);
Something like this should work, if only the exceptions due to which the program crashes with screens from doStuff()
.
Even if you do not expect the program to crash when it is finished, I think this approach is better than possibly wrapping it in a shell script that will somehow kill the Python process. Processing it in your program is less complicated, and itβs even nice to save the code after the program ends, since you may have errors that you donβt know about.
Arlaharen
source share