1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge branch '10.1' into 10.2

This commit is contained in:
Sergei Golubchik
2018-02-22 08:39:24 +01:00
15 changed files with 318 additions and 73 deletions

View File

@ -186,8 +186,10 @@ sub create_process {
# it and any childs(that hasn't changed group themself)
setpgrp(0,0) if $opts{setpgrp};
if ( $output and !open(STDOUT, $open_mode, $output) ) {
croak("can't redirect STDOUT to '$output': $!");
if ( $output ) {
close STDOUT;
open(STDOUT, $open_mode, $output)
or croak "can't redirect STDOUT to '$output': $!";
}
if ( $error ) {
@ -196,8 +198,10 @@ sub create_process {
croak("can't dup STDOUT: $!");
}
}
elsif ( ! open(STDERR, $open_mode, $error) ) {
croak("can't redirect STDERR to '$error': $!");
else {
close STDERR;
open(STDERR, $open_mode, $error)
or croak "can't redirect STDERR to '$error': $!";
}
}

23
mysql-test/lib/My/Tee.pm Normal file
View File

@ -0,0 +1,23 @@
package My::Tee;
# see PerlIO::via
our $copyfh;
sub PUSHED
{
open($copyfh, '>', "$::opt_vardir/log/stdout.log")
or die "open(>$::opt_vardir/log/stdout.log): $!"
unless $copyfh;
bless { }, shift;
}
sub WRITE
{
my ($obj, $buf, $fh) = @_;
print $fh $buf;
print $copyfh $buf;
return length($buf);
}
1;