Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by ikegami (Pope)
on Aug 08, 2013 at 03:57 UTC ( #1048477=note: print w/ replies, xml ) Need Help??


in reply to Is there a problem with IPC::Open on Windows 7?

It's not broken, and it's not Windows-specific. Passing undef for the third arg has a special meaning. This is covered in the first paragraph of the documentation, which refers to the Synopsis for how to achieve what you want.

Note that you have a deadlock potential in your code. While the parent is blocked reading from the child's STDOUT, the child could block trying to write to its STDERR. I strongly discourage the use of this low-level module if you plan on reading from both the child's STDOUT and its STDERR. Instead, try IPC::Run3 or IPC::Run.


Comment on Re: Is there a problem with IPC::Open on Windows 7?
Re^2: Is there a problem with IPC::Open on Windows 7?
by BrowserUk (Pope) on Aug 08, 2013 at 04:42 UTC
    It's not broken,

    It is broken. It may be "broken by design"; but it is broken.


    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.

      The design isn't broken either. It's perfectly simple and makes sense.

      open(\*IN, \*OUT, \*ERR, ...) # Get three pipes back open(\*IN, \*OUT, undef, ...) # Get two pipes back, # one catches both STDOUT and STDERR

      It's using lexicals that causes problems. This module predates lexicals.

        It's using lexicals that causes problems. This module predates lexicals.

        13 years on and it doesn't support lexicals. is 'Broken by Design'.

        And even if you use globs, there is no sensible way to use the 3 handle version on windows because select doesn't work on file handles.

        Even the documentation is sorely lacking.

        At the very least there should be a big, clear warning "Doesn't work with lexicals" in the warnings section. The bland parenthetical "(this means that an autovivified lexical cannot be used for the STDERR filehandle, see SYNOPSIS)" is hardly adequate given the nature of the limitation and the module's raison d'etre.

        The discussion regarding the likelihood of deadlocking when trying to process two concurrent asynchronous streams is also woefully inadequate.

        The modules place in the core and frequent recommendations, bely the difficulty of its practical use; which is further compounded by the lack of discussion of those difficulties, and examples of working around them.


        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.
Re^2: Is there a problem with IPC::Open on Windows 7?
by glasswalk3r (Pilgrim) on Aug 12, 2013 at 18:04 UTC

    Instead of using globs or lexicals, I'm checking about using sockets instead of file handles as used in https://github.com/lucastheisen/ipc-open3-callback. So far, select seems to be working fine, but I need to do more tests (like generating something into the child process STDERR).

    Documentation of IPC::Open3 in the Synopsis uses use Symbol 'gensym', which could be applied to all three lexicals. If I'm not wrong, this is the approach used by IPC::Run or IPC::Cmd. Is this expected to fail too?

    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://1048477]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2014-12-21 01:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (100 votes), past polls