Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^6: Is there a problem with IPC::Open on Windows 7?

by BrowserUk (Pope)
on Aug 12, 2013 at 18:39 UTC ( #1049161=note: print w/ replies, xml ) Need Help??


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

it seems to be possible to dup() sockets under MS Windows and use select()

Really? How would that work?

To the best of my knowledge -- which I thought was pretty good on this subject -- Perl's select is implemented in terms of the winSock select() function which will always return WSAENOTSOCK if any of the descriptors in the set is not a socket.


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.


Comment on Re^6: Is there a problem with IPC::Open on Windows 7?
Re^7: Is there a problem with IPC::Open on Windows 7?
by glasswalk3r (Pilgrim) on Aug 13, 2013 at 15:56 UTC
    Really? How would that work? To the best of my knowledge -- which I thought was pretty good on this subject -- Perl's select is implemented in terms of the winSock select() function which will always return WSAENOTSOCK if any of the descriptors in the set is not a socket.

    I'm not a MS Windows specialist and I cannot give all the details of how it works since I copying implementation code from others, but so far it is working 100% for STDOUT, and some initial testing for STDERR is looking good too.

    Here is one implementation which I based mine: https://github.com/lucastheisen/ipc-open3-callback

    And here is my implementation (take a look at Siebel::Srvrmgr::Daemon run() method and Test::Siebel::Srvrmgr::Daemon runs_with_stderr() method): http://code.google.com/p/siebel-monitoring-tools/source/browse/

    Specific to the runs_with_stderr method, the test is not complete (the return code is being get from the Log::Log4perl log method) but if you keep the default logger configuration (see Siebel::Srvrmgr) you will get the STDERR from the srvrmgr-mock.pl script (included in the distribution).

    Alceu Rodrigues de Freitas Junior
    ---------------------------------
    "You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill
      Here is one implementation which I based mine: https://github.com/lucastheisen/ipc-open3-callback

      Okay. That makes more sense than your original description -- though I see how you arrived at that description.

      Essentially, they are doing the same thing as Win32::SocketPairopen2() and Win32::SocketPairopen2_5() (original author:salva), in that they are redirecting the outputs from the commands via socket pairs, which are selectable.

      I'm like the idea of IPC::Open3::Callback. It is a very clever way to address both the problems with IPC::Open3.

      However, as it stands, it steals both the pid of the subprocess, and the stdin; which make it less useful than it could be. I can see myself stealing the idea of the callbacks and producing my own version that corrects for those. (Assuming the author doesn't modify his interface before sending it to cpan :)


      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.

        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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (14)
As of 2014-07-10 13:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (211 votes), past polls