Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Capture-Tiny CPAN distribution.

Report information
The Basics
Id: 79736
Status: resolved
Priority: 0/
Queue: Capture-Tiny

People
Owner: Nobody in particular
Requestors: JSWARTZ [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.19
Fixed in: (no value)



Subject: Nested capture_merged and system calls
This script #!/usr/bin/perl use Capture::Tiny qw(capture_merged); use warnings; use strict; my ( $outer, $inner ); $outer = capture_merged { $inner = capture_merged { print STDERR q{message1}; system("perl -e 'print STDERR q{message2}'"); }; }; printf "outer = '%s'\n", $outer || 'undef'; printf "inner = '%s'\n", $inner || 'undef'; prints outer = 'message2' inner = 'message1' so the standard error of the system() command goes to the outer capture, rather than the inner one. This is obviously confusing if the inner and outer captures are separated by many scopes. Is this a bug or just an unavoidable side-effect of the way capture_merged is implemented? Reproduced on both OS X perl5.12 and Debian perl5.14.
Subject: Re: [rt.cpan.org #79736] Nested capture_merged and system calls
Date: Tue, 18 Sep 2012 21:35:02 -0400
To: bug-Capture-Tiny [...] rt.cpan.org
From: David Golden <dagolden [...] cpan.org>
On Tue, Sep 18, 2012 at 6:09 PM, Jonathan Swartz via RT <bug-Capture-Tiny@rt.cpan.org> wrote: Show quoted text
> Is this a bug or just an unavoidable side-effect of the way > capture_merged is implemented?
The latter. The merger is a literal merger -- reopening STDERR to STDOUT. It is not multiplexing the streams. I suppose this could be documented better. David -- David Golden <dagolden@cpan.org> Take back your inbox! → http://www.bunchmail.com/ Twitter/IRC: @xdg
Subject: Re: [rt.cpan.org #79736] Nested capture_merged and system calls
Date: Tue, 18 Sep 2012 20:15:53 -0700
To: bug-Capture-Tiny [...] rt.cpan.org
From: Jonathan Swartz <swartz [...] pobox.com>
Ok. Yeah, it could be, thanks. Jon On Sep 18, 2012, at 6:35 PM, David Golden via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=79736 > > > On Tue, Sep 18, 2012 at 6:09 PM, Jonathan Swartz via RT > <bug-Capture-Tiny@rt.cpan.org> wrote:
>> Is this a bug or just an unavoidable side-effect of the way >> capture_merged is implemented?
> > The latter. The merger is a literal merger -- reopening STDERR to > STDOUT. It is not multiplexing the streams. > > I suppose this could be documented better. > > David > > > -- > David Golden <dagolden@cpan.org> > Take back your inbox! → http://www.bunchmail.com/ > Twitter/IRC: @xdg >
Subject: Re: [rt.cpan.org #79736] Nested capture_merged and system calls
Date: Wed, 19 Sep 2012 12:33:12 -0400
To: bug-Capture-Tiny [...] rt.cpan.org
From: David Golden <dagolden [...] cpan.org>
On Tue, Sep 18, 2012 at 6:09 PM, Jonathan Swartz via RT <bug-Capture-Tiny@rt.cpan.org> wrote: Show quoted text
> > Is this a bug or just an unavoidable side-effect of the way > capture_merged is implemented?
I take back what I said. This might be a bug. Or it might be unavoidable. It will take further digging. David -- David Golden <dagolden@cpan.org> Take back your inbox! → http://www.bunchmail.com/ Twitter/IRC: @xdg
Subject: Re: [rt.cpan.org #79736] Nested capture_merged and system calls
Date: Wed, 19 Sep 2012 12:41:48 -0400
To: bug-Capture-Tiny [...] rt.cpan.org
From: David Golden <dagolden [...] cpan.org>
Here is a better test case that shows that the problem affects only one stream. That looks like a bug. Not sure if it's in Capture::Tiny or Perl, yet, though. David #!/usr/bin/env perl use Capture::Tiny qw(capture_merged); use warnings; use strict; my ( $outer, $inner ); $outer = capture_merged { $inner = capture_merged { print STDOUT q{stdout-message1|}; print STDERR q{stderr-message1|}; system("perl -e 'print STDOUT q{stdout-message2|}; print STDERR q{stderr-message2|}'"); }; }; printf "outer = '%s'\n", $outer || 'undef'; # stderr-message2 printf "inner = '%s'\n", $inner || 'undef'; # stdout-message1|stderr-message1|stdout-message2|
CC: JSWARTZ [...] cpan.org
Subject: Re: [rt.cpan.org #79736] Nested capture_merged and system calls
Date: Wed, 19 Sep 2012 09:58:27 -0700
To: bug-Capture-Tiny [...] rt.cpan.org
From: Jonathan Swartz <swartz [...] pobox.com>
Yeah - actually this code is closer to how I originally found the bug, but I was trying to simplify for the bug report. :) On Sep 19, 2012, at 9:42 AM, David Golden via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=79736 > > > Here is a better test case that shows that the problem affects only > one stream. That looks like a bug. Not sure if it's in Capture::Tiny > or Perl, yet, though. > > David > > #!/usr/bin/env perl > use Capture::Tiny qw(capture_merged); > use warnings; > use strict; > > my ( $outer, $inner ); > $outer = capture_merged { > $inner = capture_merged { > print STDOUT q{stdout-message1|}; > print STDERR q{stderr-message1|}; > system("perl -e 'print STDOUT q{stdout-message2|}; print STDERR > q{stderr-message2|}'"); > }; > }; > > printf "outer = '%s'\n", $outer || 'undef'; # stderr-message2 > printf "inner = '%s'\n", $inner || 'undef'; # > stdout-message1|stderr-message1|stdout-message2| >
Subject: Re: [rt.cpan.org #79736] Nested capture_merged and system calls
Date: Wed, 19 Sep 2012 13:22:26 -0400
To: bug-Capture-Tiny [...] rt.cpan.org
From: David Golden <dagolden [...] cpan.org>
Should be fixed in Capture::TIny 0.20 on the way to CPAN now. David On Wed, Sep 19, 2012 at 12:58 PM, Jonathan Swartz via RT <bug-Capture-Tiny@rt.cpan.org> wrote: Show quoted text
> Queue: Capture-Tiny > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=79736 > > > Yeah - actually this code is closer to how I originally found the bug, but I was trying to simplify for the bug report. :) > > On Sep 19, 2012, at 9:42 AM, David Golden via RT wrote: >
>> <URL: https://rt.cpan.org/Ticket/Display.html?id=79736 > >> >> Here is a better test case that shows that the problem affects only >> one stream. That looks like a bug. Not sure if it's in Capture::Tiny >> or Perl, yet, though. >> >> David >> >> #!/usr/bin/env perl >> use Capture::Tiny qw(capture_merged); >> use warnings; >> use strict; >> >> my ( $outer, $inner ); >> $outer = capture_merged { >> $inner = capture_merged { >> print STDOUT q{stdout-message1|}; >> print STDERR q{stderr-message1|}; >> system("perl -e 'print STDOUT q{stdout-message2|}; print STDERR >> q{stderr-message2|}'"); >> }; >> }; >> >> printf "outer = '%s'\n", $outer || 'undef'; # stderr-message2 >> printf "inner = '%s'\n", $inner || 'undef'; # >> stdout-message1|stderr-message1|stdout-message2| >>
> >
-- David Golden <dagolden@cpan.org> Take back your inbox! → http://www.bunchmail.com/ Twitter/IRC: @xdg
Subject: Re: [rt.cpan.org #79736] Nested capture_merged and system calls
Date: Wed, 19 Sep 2012 16:21:06 -0700
To: bug-Capture-Tiny [...] rt.cpan.org
From: Jonathan Swartz <swartz [...] pobox.com>
Looks fixed, thanks! On Sep 19, 2012, at 10:23 AM, David Golden via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=79736 > > > Should be fixed in Capture::TIny 0.20 on the way to CPAN now. > > David > > On Wed, Sep 19, 2012 at 12:58 PM, Jonathan Swartz via RT > <bug-Capture-Tiny@rt.cpan.org> wrote:
>> Queue: Capture-Tiny >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=79736 > >> >> Yeah - actually this code is closer to how I originally found the bug, but I was trying to simplify for the bug report. :) >> >> On Sep 19, 2012, at 9:42 AM, David Golden via RT wrote: >>
>>> <URL: https://rt.cpan.org/Ticket/Display.html?id=79736 > >>> >>> Here is a better test case that shows that the problem affects only >>> one stream. That looks like a bug. Not sure if it's in Capture::Tiny >>> or Perl, yet, though. >>> >>> David >>> >>> #!/usr/bin/env perl >>> use Capture::Tiny qw(capture_merged); >>> use warnings; >>> use strict; >>> >>> my ( $outer, $inner ); >>> $outer = capture_merged { >>> $inner = capture_merged { >>> print STDOUT q{stdout-message1|}; >>> print STDERR q{stderr-message1|}; >>> system("perl -e 'print STDOUT q{stdout-message2|}; print STDERR >>> q{stderr-message2|}'"); >>> }; >>> }; >>> >>> printf "outer = '%s'\n", $outer || 'undef'; # stderr-message2 >>> printf "inner = '%s'\n", $inner || 'undef'; # >>> stdout-message1|stderr-message1|stdout-message2| >>>
>> >>
> > > > -- > David Golden <dagolden@cpan.org> > Take back your inbox! → http://www.bunchmail.com/ > Twitter/IRC: @xdg >
Thanks for confirming the fix. Marking this resolved.