Re: Incompatibility between Test::Command and System::Command?

[email protected] (Grzegorz Dzięgielewski)
Newsgroups perl.moose
Message-ID <[email protected]>
W dniu 03.01.2012 23:55, Buddy Burden pisze:
> Guys,
>
> Okay, I got it down to this, but I can't seem to narrow it down
> further.  Time to call in the big guns.(*)
>
> This code:
>
> #! /usr/bin/perl
>
> use Test::More 0.88;
> use Test::Command;
>
> stderr_like(q{ perl -le 'print STDERR "STDERR points to ", readlink
> "/proc/self/fd/2"' },
>         qr/STDERR points to/, 'should always pass');
>
> done_testing;
>
> produces this output (as expected):
>
> [tyr:~] ./test.t
> ok 1 - should always pass
> 1..1
>
> However, _this_ code:
>
> #! /usr/bin/perl
>
> use Test::More 0.88;
> use Test::Command;
>
> use System::Command;
>
> stderr_like(q{ perl -le 'print STDERR "STDERR points to ", readlink
> "/proc/self/fd/2"' },
>         qr/STDERR points to/, 'should always pass');
>
> done_testing;
>
> produces this:
>
> [tyr:~] ./test.t
> STDERR points to /dev/pts/0
> not ok 1 - should always pass
> #   Failed test 'should always pass'
> #   at ./test.t line 8.
> #                   ''
> #     doesn't match '(?-xism:STDERR points to)'
> 1..1
> # Looks like you failed 1 test of 1.
>
> which is entirely unexpected.  Can anyone tell me:
>
> 1) What's going on here?
> 2) Is there any way to work around it?
> 3) Is there perhaps another way to do what I'm trying to do that won't
> trigger this?
>
> To clarify #3, I'm not actually using System::Command, I'm using
> Git::Repository (which uses Git::Repository::Command, which uses
> System::Command).  I'm using Git::Respository so I can do this test:
>
> lives_ok { Git::Repository->new( work_tree => $packages_dir ) } 'basic
> sanity check: packages dir is in a Git repo';
>
> which works great, but perhaps there's another way to do this without
> using G::R, which is obviously causing me issues.
>
> TIA for any suggestions you guys have!  (And happy 2012, everybody!)
I've noticed the same thing, but with STDOUT and with Test::Output
and/or FastCGI.

There is a hack in System::Command for Catalyst which causes this.
See https://rt.cpan.org/Public/Bug/Display.html?id=73614

-- 
Grzegorz Dzięgielewski
http://jabbas.eu
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.