force coredump from child created by subprocess
ext at sidvind.com
Tue Oct 5 14:45:54 CEST 2010
-----BEGIN PGP SIGNED MESSAGE-----
On 10/05/2010 02:37 PM, Christian Heimes wrote:
> 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
>> 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))
Thanks, it works perfect if I run in in preexec_fn.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
More information about the Python-list