dagolden / Capture-Tiny

(Perl) Capture STDOUT and STDERR from Perl, XS or external programs
http://search.cpan.org/dist/Capture-Tiny/
39 stars 19 forks source link

Does not capture stdout on FreeBSD 9.2 amd64 running in Dancer #15

Closed amishHammer closed 7 years ago

amishHammer commented 10 years ago

p5-Capture-Tiny-0.23 perl5-5.16.3_4 p5-Dancer-1.3119_1

This happens when running under dancer only not when running form a simple script.

dagolden commented 10 years ago

It's possible that something in Dancer is hijacking the output handles in an incompatible way. Can you provide an isolated test application that demonstrates the problem?

bentglasstube commented 7 years ago

Here is a minimal example of this not working:

#!/usr/bin/env perl

use Capture::Tiny 'capture_stdout';
use Dancer;

get '/' => sub {
  my $capture = capture_stdout { system 'echo', 'world'; };
  return "Hello, $capture";
};

dance;
bentglasstube commented 7 years ago

For what it's worth, this is no longer an issue in Dancer2.

xdg commented 7 years ago

If it's fixed in Dancer2, I'm going to close this ticket. Thanks for verifying the two cases.