in reply to Re: How I'm sure syswrite has finished?
in thread How I'm sure syswrite has finished?

Many thanks ikegami,

I tried wait_all_children (see answer below) but without success.

Somehow the $pm->finish (I also tried a plain exit) with the same result aborts the whole writing?.

I guess that somehow the call to syswrite produces a decoupled process in the remote machine than is in charge of fulfilling the writing (since it is a huge message). When the exit of the forked local child occurs the remote process is aborted?

  • Comment on Re^2: How I'm sure syswrite has finished?

Replies are listed 'Best First'.
Re^3: How I'm sure syswrite has finished?
by Anonymous Monk on Mar 15, 2009 at 20:54 UTC
    I think your issue is that the open of ssh on the local end is also a fork. I'm guessing that maybe close isn't waiting for the child to finish when using open2 the way it does for open. perlipc says open does but doesn't mention this regarding open2. I would wait for the ssh processes to finish before calling $pm->finish. See the waitpid function as well as perlipc.