Ok yea, then that is what my colleague thought you meant. His solution
looks like this, but it is linux-only:

import signal
import subprocessfrom ctypes import cdll

libc = cdll.LoadLibrary('libc.so.6')

child = subprocess.Popen(["/bin/sleep", "100"], preexec_fn=lambda
*args: libc.prctl(1, signal.SIGTERM, 0, 0, 0))

That would use the C prctrl to set the child death signal to SIGTERM when
the parent dies.

So yea, it isn’t portable, and you would have to search for whatever the
equivalent is in Windows or BSD. That is probably why you might have to
just take on a cross-platform library that handles this stuff.

On Thu, Mar 5, 2015 at 9:23 PM Marcus Ottosson <[email protected]>
wrote:

Good point, it is the other way; A launches B which launches C. That is,
> Maya launches the child process.​
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/python_inside_maya/CAFRtmODKexSh7PU7TJmoyYgzmyrJP
> dCKNYroW64-cEDRbGny1Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODKexSh7PU7TJmoyYgzmyrJPdCKNYroW64-cEDRbGny1Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
​

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3Ce2wDaXtRK3v0PGC%2B5vmR1aeBzC46hzsw9d2McZp_KQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to