If you service the pipes, the process will terminate
Yes, that stops it from hanging, but when I apply that change to 00_ptr_cast.t the executable that should be built by $cmd doesn't get built. The object file gets created, but that's as far as it gets.
This stuff is unbelievably buggy. Stuff that works in a demo script fails when applied to the 00_ptr_cast test script. And it's a bloody pain - I have to close the console and open up a new one so I can delete the test executable (on those occasions where the test executable actually gets built).
Cheers, Rob | [reply] |
... the executable that should be built by $cmd doesn't get built.
Well, one problem (assuming that you're using MS VC for these builds), is that -o is not a valid switch for cl. It would have to be /Fe to name the executable; or /Fo to name the object file. (It's unclear to me which -o is trying to do).
Also, the script doesn't add an extension to $output, so if it is the object file, the linker probably won't find it. If it is the executable, it won't work.
Which brings us to the question: Why are they suppressing and ignoring all the output from the commands? The very stuff which would tell you what is going wrong. The answer is of course--because it would mess with the totally useless bean-counting output from the test harness!
This stuff is unbelievably buggy.
Without having looked at the rest of what's going on, just the two .t files you've linked, I do not understand at all why they are using IPC::Open3 (which historically I've had no end of trouble with on windows anyway), rather than a simple system command?
All they seem to be doing is running a command and waiting for it to finish. The only benefit of using open3 seems to be the ability to ignore the output from the commands stdout & stderr so they do not interfere with the test harness' use of stdout & stderr (which I've said enough on previously and which falls on deaf ears!).
Personally, I'd try replacing all the uses of open3() with system $cmd 2>&1 >nul, which I believe would achieve the same thing and avoid the problems of open3 entirely.
Under 32-bit, I always installed Net::SSLeay via PPM (from trouchelle.com or maybe one of jenda's repositories?)...so someone must have solved these problems under win32. I find it hard to believe that they are seriously more severe under win64?
I could be wrong on that--I'm still only just starting out on win64--there is a lot to discover--but mostly so far, most things seem to work much the same.
Suggestion: Service the output using:
my $pid = open3 ....;
print "# $_" while <$out>;
print "# $_" while <$err>;
waitpid $pid, 0;
By commentifying the compiler output it should get passed through by the test harness and allow you to see the diagnostics that will tell you what is going on. Maybe?
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.
| [reply] [d/l] [select] |
-o is not a valid switch for cl
It's deprecated, but still seems to work.
the script doesn't add an extension to $output
I had modified the command to append a '.exe'.
I do not understand at all why they are using IPC::Open3
Nor do I.
Taking your suggestion, I opted to use 'warn' instead of 'print', in case STDOUT was going somewhere other than to the console. When I do:
warn "# $_" while <$out>;
warn "# $_" while <$err>;
I get to see that I need to additionally link to bufferoverflowU.lib - and when I modify $cmd to do that, the executable gets built, and all bar one of the 00_ptr_cast.t tests pass:
ok 1 - compiling ptr_cast_test.c
not ok 2 - STDERR empty after compiling
# Failed test 'STDERR empty after compiling'
# at t/local/00_ptr_cast.t line 30.
# got: undef
# expected: ''
ok 3 - ./ptr_cast_test exited with 0
ok 4 - casting pointer integer and back worked
ok 5 - STDERR empty after running
# Looks like you failed 1 test of 5.
Maybe tomorrow I'll look at filing a bug report. Thanks muchly for the help.
Cheers, Rob | [reply] [d/l] [select] |
Not sufficient. That won't help if the child blocks on printing STDERR, since the parent is blocked reading from the child's STDOUT.
use warnings;
use strict;
use Symbol qw(gensym);
use IPC::Open3;
my $out = gensym();
my $err = gensym();
my $cmd = 'dir 1>&2';
my $pid = open3(undef, $out, $err, $cmd);
1 while <$out>;
1 while <$err>;
waitpid $pid, 0;
| [reply] [d/l] |
my $t1 = async{ 1 while <$out> };
my $t2 = async{ 1 while <$err> };
$_->join for $t1, $t2;
...
However, if your redirecting stdout to stderr, is there any point in reading stdout? And if you're going to discard the output without looking at it, why not just dump the whole lot to nul and have done with it?
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.
| [reply] [d/l] |
| [reply] [d/l] |