|Do you know where your variables are?|
Re^2: How can I pass an open session of Net::SSH2 to a script running in a forked subprocess?by blue_cowdawg (Monsignor)
|on Oct 17, 2012 at 16:16 UTC||Need Help??|
Not 100% sure what you meant by that, but to review:
When you execute fork a copy of not only the environment but any variables pass from the parent to the child. If the child or parent modify their copy then the copies are out of sync.
A strategy to change this behavior can be to leverage off of signals.
Be careful here though as your mileage may vary wildly depending on the OS you are running on. The above signals exist on a Windows 7 box running Cygwin/X.
Those exist on CentOS. While there's commonality between those two I cannot vouch for other environments. The basic strategy is thus:
where parentHanlder and childHandler are mirror images of one another and take action appropriatly when the signal arrives.
Another strategy is to use the socketpair() system call. Read up on this strategy in peripc for more details. This allows for bidirectional communications between a child and parent very nicely.
Food for thought I hope...
Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg