Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Re: getting a child's process ID

by blackmateria (Chaplain)
on Oct 19, 2001 at 21:27 UTC ( [id://120077]=note: print w/replies, xml ) Need Help??


in reply to Re: getting a child's process ID
in thread getting a child's process ID

jlongino -- much to my chagrin when working on Windows, Win32 doesn't have a (portable) getppid() equivalent. The closest equivalent is the Process32*() functions in the toolhelp library--these have a way of getting the parent pid. Unfortunately, they don't work on WinNT 4.0. Also, ActivePerl doesn't appear to use toolhelp (at least, a quick "grep -ir process32 *" from the root of my ActivePerl build 613 install didn't turn up anything). There might be a CPAN module that talks to toolhelp, I'm not sure. In any case, it's not portable.

I'd say your best bet is to either use some form of inter-process communication (if you have control of the parent process), or else use the Cygwin version of perl instead of ActiveState if you can. getppid() works in that version. Also, beware of ActiveState's fork() -- it doesn't play very well with their implementation of sockets. I usually end up either using Cygwin or, for C programs, writing IPC code. Hope this helps!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://120077]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-26 06:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found