fork and exit;
POSIX::setsid or die "Couldn't setsid: $!";
fork and exit;
- close STDERR;
- open STDERR, '>', '/dev/null' or die "Couldn't re-open stderr: $!";
- Log::Contextual::set_logger( # there's no NullLogger? I thought I wrote one
- Log::Contextual::SimpleLogger->new({ levels => [] })
- );
return 'done';
}
# because this is funnier than "no warnings 'once'". Also because
# I don't have to stop and think "what else is in this lexical scope?"
$Tak::STDIOSetup::Next = $Tak::STDIOSetup::Next = sub {
+
+ # have to do this here because when we're being set up stderr may
+ # be redirected (e.g. because we're in an ->do under a repl) - and
+ # plus it leaves logging running until the last possible minute,
+ # which is almost certainly a win anyway.
+ close STDERR;
+ open STDERR, '>', '/dev/null' or die "Couldn't re-open stderr: $!";
+ Log::Contextual::set_logger( # there's no NullLogger? I thought I wrote one
+ Log::Contextual::SimpleLogger->new({ levels => [] })
+ );
+
my $x = $self; # close over while evading void context warnings
$0 = 'tak-daemon-node';
Tak->loop_until($done);