I've started to patch the test of Term::ProgressBar as it was failing
on Windows.
The module prints things to STDERR and dies when it is called too many times.
In the test script there is now code like this:

use Test::More;
use Test::Exception;
use Capture::Tiny qw(capture);

my ($our, $err) = capture {
     lives_ok { code };
     lives_ok { code };
};
print $out;
like $err, qqr/.../;

The problem is that within the capture there are test assertions that
need to be able to print to STDOUT so after capturing them I have
to print them out manually (print $out) to keep the TAP flow.

I could probably remove the lives_ok wrappers eliminating this
problem, but I think the reason there are several lives_ok calls
within the capture block is to help pinpoint the exact piece
of "code" that died.

So probably what I need is a version of "capture" that will only
capture STDERR and let STDOUT flow through.

I have not seen such capability in Capture::Tiny.

What is your suggestion to solve this?
Does a request for such feature in Capture::Tiny sound reasonable?

regards
   Gabor

Reply via email to