I tried it - even that doesn't work in this case on windows ... | [reply] |
Here is a simple example showing that even Capture::Tiny doesn't work in this case on Windows.
#!/usr/bin/perl
use Capture::Tiny 'capture';
use File::Temp qw(tempfile);
use Inline C;
my ($stdout, $stderr) = capture { test_err() };
print "|$stderr|\n";
__END__
__C__
void test_err()
{
(void)fprintf (stderr, "ERROR");
}
| [reply] [d/l] |
| [reply] [d/l] [select] |
I'm embarrassed. Someone pointed out to me that Windows doesn't flush STDERR as often as other OSES. With one extra line of C, it works on Windows and I think I can modify the external library this much ...
#!/usr/bin/perl
use Capture::Tiny 'capture';
use File::Temp qw(tempfile);
use Inline C;
my ($stdout, $stderr) = capture { test_err() };
print "|$stderr|\n";
__END__
__C__
void test_err()
{
(void)fprintf (stderr, "ERROR");
(void)fflush(stderr);
}
| [reply] [d/l] |