force coredump from child created by subprocess

Christian Heimes lists at
Tue Oct 5 14:37:06 CEST 2010

Am 05.10.2010 14:15, schrieb David Sveningsson:
> Hi, I am running a process using subprocess and detect if the process
> crashes using .returncode. I would like to force coredumps being created
> regardless of the system settings, eg run "ulimit -c unlimited" in the
> childprocess.
> I've had no luck using preexec_fn and os.system, it just made no
> difference. I could probably add a thin wrapper script but I'm not very
> fond of that idea.
> Is there some easy way to force the childprocess to create a coredump if
> it crashes?

This code snippet enables core dumps for the current Python process. It
should also enable it for child processes.

import resource
resource.setrlimit(resource.RLIMIT_CORE, (-1, -1))


More information about the Python-list mailing list