Capture “Segmentation fault” message for a crashed subprocess: no out and err after a call to communicate()

“Segmentation fault” message might be generated by a shell. To find out, whether the process is kill by SIGSEGV, check proc.returncode == -signal.SIGSEGV. If you want to see the message, you could run the command in the shell: #!/usr/bin/env python from subprocess import Popen, PIPE proc = Popen(shell_command, shell=True, stdout=PIPE, stderr=PIPE) out, err = proc.communicate() … Read more

segfault only when NOT using debugger

Classic Heisenbug. From Wikipedia: Time can also be a factor in heisenbugs. Executing a program under control of a debugger can change the execution timing of the program as compared to normal execution. Time-sensitive bugs such as race conditions may not reproduce when the program is slowed down by single-stepping source lines in the debugger. … Read more