On Sun, 8 Mar 2015 8:22 AM Marcus Ottosson wrote:
Thanks a lot, guys. psutil is looking amazing so far.
I mean, how cool is this?
# Kill children of process id 1234 import psutil for child in
psutil.Process(1234).children(): child.kill()
For polling, I’m thinking something like this will suff
Thanks a lot, guys. psutil is looking amazing so far.
I mean, how cool is this?
# Kill children of process id 1234
import psutil
for child in psutil.Process(1234).children():
child.kill()
For polling, I’m thinking something like this will suffice.
psutil.Process(1234).wait()
sys.exit()
On
Nevermind on what I said about psutil. On windows its a heavy handed
operation to get a parent process id, or check if a pid exists because
process management on windows is harder. So yea polling with psutil in a
thread may be the only cross platform approach. I found a windows approach
that mimics
On posix, the value of the parent pid changes if it dies and the child
orphans , to either 1 or 0. Not sure what the behaviour is on Windows. You
would have to be careful about trying to poll exactly for a specific pid of
the parent since it is possible for the pid to get reused.
The actual polling
I think you can poll a pid using psutil. Check out its Process class.
// F
fre 6 mar 2015 kl. 16:46 skrev Marcus Ottosson :
> No problem, Justin, it’s not terribly obvious that it’s using pywin32 as
> it isn’t showing up in the imports; it looks like it’s got quite a few
> different names, all pr
No problem, Justin, it’s not terribly obvious that it’s using pywin32 as it
isn’t showing up in the imports; it looks like it’s got quite a few
different names, all prefixed win32.
A ctypes approach seems reasonable. Haven’t considered it beyond a few
non-working examples, but I bet it must be abl
On Fri, Mar 6, 2015 at 11:17 AM Marcus Ottosson
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.
>
> I
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.
>From the st
Does this solution help?
http://stackoverflow.com/a/12942797/496445
It uses the Windows "Job Object" constructs.
On Fri, Mar 6, 2015 at 10:52 AM Marcus Ottosson
wrote:
> Yeah, that's not particularly Windows-friendly unfortunately, and I don't
> know of any cross-platform library that does th
Yeah, that's not particularly Windows-friendly unfortunately, and I don't
know of any cross-platform library that does this. Thanks for sharing
anyway.
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from t
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.
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,
Hey,
I was reading your question a certain way at first (which is more
complicated) and posed it to a colleague since he loves process management
questions. He actually read it the other way, and gave me an answer that
addresses how to manage the standard parent-child relationship where Maya
is st
I might add that, from what I can tell, the Windows method of achieving
this is apparently quite different and more difficult than the Unix
version, so although Unix suggestions would be great, I'm mainly looking
for a solution which works well on Windows; even if it's Windows-only.
Thanks
--
Yo
Hi all,
I’d like something like this.
1. Maya is launched
2. A child process is launched; via e.g. subprocess.Popen
3. Upon exiting Maya, I’d like the child process to be killed
Ideally, it dies no matter how the parent died; be it normally or when
crashing. And ideally, it’d be cross-p
15 matches
Mail list logo