Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I'm in quite a serious dilemma with TAPx::Parser. It's getting close to the point of being beta, but there's a nasty Windows bug that I cannot solve because I don't have access to a Windows box and since I have no experience with inter-process communications on Windows, I wouldn't even know where to start.

I have the following code in TAPx::Parser::Source:

use IPC::Open3; use IO::Select; use IO::Handle; #<snip> my $stdout = IO::Select->new(); my $stdout_handle = IO::Handle->new(); $stdout_handle->autoflush(1); $stdout->add( \*STDOUT ); $stdout->add($stdout_handle); if ( my $pid = open3( undef, $stdout_handle, undef, $command ) ) { return TAPx::Parser::Iterator->new($stdout_handle); } else { $self->exit( $? >> 8 ); $self->error("Could not execute ($command): $!"); return; }

This code is intended to merge STDIN and STDOUT and keep them synchronized (no buffering problems). It runs fine on Mac OS X, Linux, FreeBSD, OpenBSD, etc. However, Win32 users keep reporting errors similar to:

# Failed test ''bignum' should parse successfully' # at t/010-regression.t line 2257. # open3: IO::Pipe: Can't spawn-NOWAIT: No such file or directory at C:\TAPx-Parser-0.50_03\blib\lib/TAPx/Parser/Source.pm line 103

(Line 103, not surprisingly, is the IPC::Open3::open3 command.)

I can't debug this since I don't have a Windows box handy. Googling and reading the Perl Cookbook have also not helped. Further, my research on this site shows many people addressing questions about IPC::Open3 shows people posting snippets, but often not fixing the original poster's code. Since I can't test anything, I need to hopefully get this right on the first try :(

The first argument to open3 is undefined since I don't need to write anything to the child. Should I include a handle and simply close it right away? The third argument is undefined because this forces STDERR an STDOUT to merge, which is the desired behavior. I would really like to get TAPx::Parser production ready and this is one of my last major blockers.

As the above code suggests, the $stdout_handle is read in TAPx::Parser::Iterator.

I really hate to be one to say "do my work for me", but I'm really stuck on this one and have no easy way to verify that it works on Windows.

Miscellaneous notes:

I don't know how to capture the exit status with the above code, either. This may not be a big deal, but it would be really nice to solve.

I've tried reading the source of IPC::Cmd, but I can't figure out how he's fixed the Windows problem. I also can't use that as a prerequisite as I need to ensure that no non-core modules are used (there's a desire expressed on the Perl-QA wiki to have a new TAP::Harness in the core and I have grandiose dreams that it's TAPx::Harness).

Update: I forgot to mention that apparently this is apparently only failing for my t/010-regression.t tests. The other tests all appear to be fine (and all use the same open3 command). The difference in the regression tests is that they run a bunch of tests in the t/sample-tests/ directory. So I have a test program, t/010-regression.t, which is run via the open3 command (apparently successfully), which in turn tries to run other tests via the open3 command (unsuccessfully) and generates the error above.

Cheers,
Ovid

New address of my CGI Course.


In reply to IPC::Open3 failure on Win32 by Ovid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-03-29 04:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found