From 72e2f57e2858f1717d4533fa6d9662055e30a172 Mon Sep 17 00:00:00 2001 From: James Laird Date: Wed, 20 Apr 2011 08:50:46 +1000 Subject: [PATCH] Fix die handling (again) --- shairport.pl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/shairport.pl b/shairport.pl index e8c38269..889ff328 100755 --- a/shairport.pl +++ b/shairport.pl @@ -106,13 +106,12 @@ my %conns; $SIG{TERM} = $SIG{INT} = sub { print "killed\n"; map { eval { kill $_->{decoder_pid} } } keys %conns; - kill 9, $avahi_publish; + kill 9, $avahi_publish if $avahi_publish; exit 0; }; $SIG{__DIE__} = sub { - print "died\n"; map { eval { kill $_->{decoder_pid} } } keys %conns; - kill 9, $avahi_publish; + kill 9, $avahi_publish if $avahi_publish; }; $avahi_publish = fork();