in reply to Re^8: Is there a problem with IPC::Open on Windows 7?
in thread Is there a problem with IPC::Open on Windows 7?

I would suggest you to contact the author of IPC::Open3::Callback: he is already trying to upload the distribution into CPAN, maybe he would be open to accept your suggestions.

I didn't get what do you mean by saying:

However, as it stands, it steals both the pid of the subprocess, and the stdin; which make it less useful than it could be.

It does has an method to retrieve the PID of the child process, something that is not available in IPC::Run and IPC::Cmd.

Alceu Rodrigues de Freitas Junior
---------------------------------
"You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill
  • Comment on Re^9: Is there a problem with IPC::Open on Windows 7?

Replies are listed 'Best First'.
Re^10: Is there a problem with IPC::Open on Windows 7?
by BrowserUk (Patriarch) on Aug 13, 2013 at 18:52 UTC
    It does has an method to retrieve the PID of the child process,

    Unless I'm looking at an out-of-date version, there is no pid method I can see.

    However, I just noticed it does have a sendInput() method. With the addition of a getPID method, that would probably address my desires.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      You're correct, there is none. It shouldn't be that hard to implement it by creating a related attribute and setting it in the runCommand method call. Since I already have one implemented in Siebel::Srvrmgr::Daemon and I really need to have complete control, I'm not considering IPC::Open3::Callback right now (but it would be worth checking it again later).

      During additional tests yesterday, I was able to run Siebel::Srvrmgr::Daemon several times without problem in Linux and being able to read STDERR as well. Unfortunately, I got the same error (ECONNRESET) that I was getting in Windows 7 when I repeated the test today:

      Researching the error in Google, I found this http://stackoverflow.com/questions/16675950/perl-select-returning-undef-on-sysread-when-using-windows-ipcopen3-and-ios, which led me to disable using shutdown in the sockets when running in Windows. It worked, but I'm not sure why besides this explanation in the documentation:

      It's also a more insistent form of close because it also disables the file descriptor in any forked copies in other processes.

      Since select and Scalar::Util openhandle tells me that the handles are OK for reading/writing, I clueless why this error happens. It seems to be related to some inactivity with the child process because if I keep calling run method sequentially, everything keeps working as expected. If I "wait" a bit, the error happens.

      This is the modified version of mswin_pipe that seems to be working as expected:

      I believe this needs more testing. I'll repeat the tests by forking a different program and see what happens in Windows. It would make sense to set SO_KEEPALIVE to the sockets/handles?

      Alceu Rodrigues de Freitas Junior
      ---------------------------------
      "You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill
        sub _mswin_pipe { my ( $read, $write ) = IO::Socket->socketpair( AF_UNIX, SOCK_STREAM, PF_UNSPEC );

        Are you running this code directly under windows or via some *nix emulation layer (eg.cygwin)?

        Because I've never seen sockets in the AF_UNIX domain created under windows.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.