aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Net/IMAP/InterIMAP.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Net/IMAP/InterIMAP.pm')
-rw-r--r--lib/Net/IMAP/InterIMAP.pm16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/Net/IMAP/InterIMAP.pm b/lib/Net/IMAP/InterIMAP.pm
index 966b965..db6f484 100644
--- a/lib/Net/IMAP/InterIMAP.pm
+++ b/lib/Net/IMAP/InterIMAP.pm
@@ -49,6 +49,7 @@ my %OPTIONS = (
password => qr/\A([\x01-\x7F]+)\z/,
auth => qr/\A($RE_ATOM_CHAR+(?: $RE_ATOM_CHAR+)*)\z/,
command => qr/\A(\/\P{Control}+)\z/,
+ 'null-stderr' => qr/\A(YES|NO)\z/i,
compress => qr/\A($RE_ATOM_CHAR+(?: $RE_ATOM_CHAR+)*)\z/,
SSL_fingerprint => qr/\A([A-Za-z0-9]+\$\p{AHex}+)\z/,
SSL_cipher_list => qr/\A(\P{Control}+)\z/,
@@ -248,11 +249,24 @@ sub new($%) {
open STDIN, '<&', $rd or $self->panic("Can't dup: $!");
open STDOUT, '>&', $wd or $self->panic("Can't dup: $!");
+ my $stderr2;
+ if (uc ($self->{'null-stderr'} // 'NO') eq 'YES') {
+ open $stderr2, '>&', *STDERR;
+ open STDERR, '>', '/dev/null' or $self->panic("Can't open /dev/null: $!");
+ }
+
my $sigset = POSIX::SigSet::->new(SIGINT);
my $oldsigset = POSIX::SigSet::->new();
sigprocmask(SIG_BLOCK, $sigset, $oldsigset) // $self->panic("Can't block SIGINT: $!");
- exec $command or $self->panic("Can't exec: $!");
+ unless (exec $command) {
+ my $err = $!;
+ if (defined $stderr2) {
+ close STDERR;
+ open STDERR, '>&', $stderr2;
+ }
+ $self->panic("Can't exec: $err");
+ }
}
# parent