I was building a custom test harness and wanted to capture diagnostic
messages produced by a few venerable Test::* modules. Unfortunately
Test::Harness::Straps redirects only reads from stdout when capturing
the output of .t files.
- As far as I can tell, Test::* modules send diagnostic info to STDERR,
which makes sense and avoids confusing any non-TAPS output.
- Test::Harness::Straps (0.26) already has a built-in method to detect
diagnostic messages a la: _is_diagnostic()
- When building a custom harness via ::Straps it would be helpful to
capture the diagnostic messages.
My Suggestion:
- allow an argument to ::Straps->new() , like ::Straps->new(
diagnostics => 1).
- modify the piped open to FH so that STDERR can be redirected if
necessary
#if --diagnostics option has been set. then redirect stderr > stdout
if( $self->{_diagnostics} == 1) { $line .= " 2>&1";}
unless ( open(FILE, "$line|" )) { #code continues...
This would allow diagnostic messages to make it to Straps for handling.
Caveats:
- The above is totally platform inconsiderate. Works only on *nix
systems.
Feedback would be appreciated.
Thanks.
-Michael