I stopped looking for a global cross-platform solution and found this to
solve the problem.

def on_application_quit():
    try:
        popen.kill()
    except OSError:
        # Already dead
        pass

cmds.scriptJob(
    event=["quitApplication", on_application_quit],
    protected=True
)

For the record, the API route did not.

def on_application_quit():
    try:
        popen.kill()
    except OSError:
        # Already dead
        pass

OpenMaya.MSceneMessage.addCallback(OpenMaya.MSceneMessage.kMayaExiting,
on_application_quit)

Assuming this isn’t called until after whatever is deadlocking Maya.
​

On 27 February 2017 at 10:05, Marcus Ottosson <konstrukt...@gmail.com>
wrote:

> Thanks for this Justin.
>
> I think this is far too deep of a rabbit hole for a problem this minor but
> take it there is no other way. Named pipes seem rather unheard of on
> Windows, so the other option of starting a subprocess via the Win32 API
> directly seems the better approach but this particular StackOverflow
> example requires an external and compiled library, namely pywin32 which
> is too much to bear.
>
> The plan then is to ignore the problem for now and hope a solution makes
> itself known in the future.
>
> Thanks everyone for your help!
> ​
>



-- 
*Marcus Ottosson*
konstrukt...@gmail.com

-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOA09rv5CxYCJySg7t-VPGGfwwL08JYNxb%2Bu7DnFHEKFsg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to