On Fri, Mar 6, 2015 at 11:17 AM Marcus Ottosson <[email protected]> wrote:
> That’s actually the same solution I posted in my initial post, and it’s > based on a non-standard library (pywin32) which is a little tricky to > bundle and is quite large, but yes, based on only a few tests, it seems to > do the job. > > It seems to differ across Windows distributions though. > Sorry, I didn't realize I was posting the same suggestion. It seems like if you don't want to carry a large external dependency, you would have to drop down into doing your own basic ctypes solution for window. > From the stackoverflow post: > > One downside to using a job object is that when running on Vista or Win7, > if your program is launched from the Windows shell (i.e., by clicking on an > icon), then there will probably already be a job object assigned and trying > to create a new job object will fail. Win8 fixes this (by allowing job > objects to be nested), or if your program is run from the command line then > it should be fine. > > Would you mind having a gander at this and see what you can make of it? > > > http://stefan.sofa-rockers.org/2013/08/15/handling-sub-process-hierarchies-python-linux-os-x/#example > > It’s the recursive nature of how the script launches itself that throws me > off, but other than that the results look to be what I’m after. > The logic with the script calling itself is just purely for the example of having it spawn a child which spawns a child, to demonstrate the signal handling. With that aside, it is just basic signal handling of watching for INT/TERM(/BREAK). The problem is that it won't solve your requirement for handling Maya crashing because the child will just end up orphaned (I'm not totally familiar on the process handling in windows). The problem you are trying to solve is getting a signal from the parent to the child if the parent actually dies, which as you are finding requires some non-portable solutions. > > > -- > 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/CAFRtmOAKPKXRd_9XwfD%2B8az-yrpd5K32DQca6Z3gqggSzQ-_mQ%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAKPKXRd_9XwfD%2B8az-yrpd5K32DQca6Z3gqggSzQ-_mQ%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/CAPGFgA2X1nUUzNuSA98iZJwvj2Ln0Q%3DrDjuDs5jkEZ%2BDCE8R9w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
