����JFIF���������
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
# Copyright (c) 2009 by David Golden. All rights reserved.
# Licensed under Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License was distributed with this file or you may obtain a
# copy of the License from http://www.apache.org/licenses/LICENSE-2.0
use strict;
use warnings;
use Test::More;
use lib 't/lib';
use Utils qw/next_fd sig_num/;
use Capture::Tiny ':all';
unless ( PerlIO->can('get_layers') ) {
plan skip_all => "Requires PerlIO::getlayers";
}
plan 'no_plan';
local $ENV{PERL_CAPTURE_TINY_TIMEOUT} = 0; # no timeouts
my $builder = Test::More->builder;
binmode( $builder->failure_output, ':utf8' ) if $] >= 5.008;
my $fd = next_fd;
my ( $out, $err, $res, @res, %before, %inner, %outer );
sub _set_layers {
my ($fh, $new_layers) = @_;
# eliminate pseudo-layers
binmode( $fh, ":raw" ) or die "can't binmode $fh";
# strip off real layers until only :unix is left
while ( 1 < ( my $layers =()= PerlIO::get_layers( $fh, output => 1 ) ) ) {
binmode( $fh, ":pop" ) or die "can't binmode $fh";
}
binmode($fh, $new_layers);
}
sub _get_layers {
return (
stdout => [ PerlIO::get_layers( *STDOUT, output => 1 ) ],
stderr => [ PerlIO::get_layers( *STDERR, output => 1 ) ],
);
}
sub _cmp_layers {
local $Test::Builder::Level = $Test::Builder::Level + 1;
my ($got, $exp, $label) = @_;
($got, $exp) = map { ":" . join(":", @$_) } $got, $exp;
is( $got, $exp, $label );
}
#--------------------------------------------------------------------------#
# relayer should duplicate layers
#--------------------------------------------------------------------------#
_set_layers( \*STDOUT, ":unix:encoding(UTF-8):encoding(UTF-8):crlf" );
_set_layers( \*STDERR, ":unix:encoding(UTF-8):encoding(UTF-8):crlf" );
%before = _get_layers();
( $out, $err, @res ) = capture {
%inner = _get_layers();
print STDOUT "foo\n";
print STDERR "bar\n";
};
%outer = _get_layers();
_cmp_layers( $inner{$_}, $before{$_}, "$_: layers inside capture match previous" )
for qw/stdout stderr/;
_cmp_layers( $outer{$_}, $before{$_}, "$_: layers after capture match previous" )
for qw/stdout stderr/;
#--------------------------------------------------------------------------#
# finish
#--------------------------------------------------------------------------#
is( next_fd, $fd, "no file descriptors leaked" );
exit 0;
# vim: set ts=4 sts=4 sw=4 et tw=75:
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| lib | Folder | 0775 |
|
|
| 00-report-prereqs.dd | File | 2.97 KB | 0644 |
|
| 00-report-prereqs.t | File | 5.88 KB | 0644 |
|
| 01-Capture-Tiny.t | File | 824 B | 0644 |
|
| 02-capture.t | File | 766 B | 0644 |
|
| 03-tee.t | File | 884 B | 0644 |
|
| 06-stdout-closed.t | File | 1 KB | 0644 |
|
| 07-stderr-closed.t | File | 1 KB | 0644 |
|
| 08-stdin-closed.t | File | 1.56 KB | 0644 |
|
| 09-preserve-exit-code.t | File | 737 B | 0644 |
|
| 10-stdout-string.t | File | 1.14 KB | 0644 |
|
| 11-stderr-string.t | File | 1.14 KB | 0644 |
|
| 12-stdin-string.t | File | 1.37 KB | 0644 |
|
| 13-stdout-tied.t | File | 1.25 KB | 0644 |
|
| 14-stderr-tied.t | File | 1.26 KB | 0644 |
|
| 15-stdin-tied.t | File | 1.27 KB | 0644 |
|
| 16-catch-errors.t | File | 1.18 KB | 0644 |
|
| 17-pass-results.t | File | 2.6 KB | 0644 |
|
| 18-custom-capture.t | File | 4.52 KB | 0644 |
|
| 19-relayering.t | File | 2.46 KB | 0644 |
|
| 20-stdout-badtie.t | File | 1.23 KB | 0644 |
|
| 21-stderr-badtie.t | File | 1.23 KB | 0644 |
|
| 22-stdin-badtie.t | File | 1.23 KB | 0644 |
|
| 23-all-tied.t | File | 1.57 KB | 0644 |
|
| 24-all-badtied.t | File | 1.5 KB | 0644 |
|
| 25-cap-fork.t | File | 1.24 KB | 0644 |
|