Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out if a program crashed with subprocess?

My application creates subprocesses. Usually, these processeses run and terminate without any problems. However, sometimes, they crash.

I am currently using the python subprocess module to create these subprocesses. I check if a subprocess crashed by invoking the Popen.poll() method. Unfortunately, since my debugger is activated at the time of a crash, polling doesn't return the expected output.

I'd like to be able to see the debugging window(not terminate it) and still be able to detect if a process is crashed in the python code.

Is there a way to do this?

like image 760
Utku Zihnioglu Avatar asked Oct 13 '22 18:10

Utku Zihnioglu


1 Answers

When your debugger opens, the process isn't finished yet - and subprocess only knows if a process is running or finished. So no, there is not a way to do this via subprocess.

like image 85
Amber Avatar answered Nov 14 '22 09:11

Amber