Skip to content

Capture specific warnings to reduce clutter in output #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion lib/Devel/IPerl/Plugin/PDLGraphicsGnuplot.pm
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ around new => sub {
# C<iperl_data_representations> is called.
capture_stderr(sub {
# capture to avoid printing out the dumping warning
local $SIG{__WARN__} = sub {
warn $_[0] unless $_[0] =~ m{
WARNING\s+-\s+dumping\s+ON
}xs;
};
$gpwin->option( dump => 1 );
});
}
Expand All @@ -57,6 +62,11 @@ around _printGnuplotPipe => sub {
#local *STDERR;
open STDOUT, '>', \$dump_stdout or die "Can't open STDOUT: $!";
#open STDERR, '>', \$dump_stderr or die "Can't open STDERR $!";
local $SIG{__WARN__} = sub {
warn $_[0] unless $_[0] =~ m{
\(killed\s+gnuplot\)
}xs;
};
return $orig->(@_);
} else {
return $orig->(@_);
Expand All @@ -66,9 +76,15 @@ around _printGnuplotPipe => sub {
sub iperl_data_representations {
my ($gpwin) = @_;
return unless $Devel::IPerl::Plugin::PDLGraphicsGnuplot::IPerl_compat;
return unless $gpwin->{replottable};
capture_stderr(sub {
# capture to avoid printing out the dumping warning
$gpwin->option( dump => 0);
local $SIG{__WARN__} = sub {
warn $_[0] unless $_[0] =~ m{
WARNING\s+-\s+dumping\s+OFF
}xs;
};
$gpwin->option( dump => 0 );
});

my $format = $Devel::IPerl::Plugin::PDLGraphicsGnuplot::IPerl_format;
Expand All @@ -88,6 +104,11 @@ sub iperl_data_representations {

capture_stderr( sub {
# capture to avoid printing out the dumping warning
local $SIG{__WARN__} = sub {
warn $_[0] unless $_[0] =~ m{
WARNING\s+-\s+dumping\s+OFF
}xs;
};
$gpwin->option( dump => 0 );
} );

Expand Down