|Think about Loose Coupling|
IPC::Open3 failure on Win32by Ovid (Cardinal)
|on Jan 09, 2007 at 19:13 UTC||Need Help??|
Ovid has asked for the
wisdom of the Perl Monks concerning the following question:
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:
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:
(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.
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.