# HG changeset patch # User Matthias Förste # Date 1424442774 -3600 # Node ID f38791e4991cb87cf52382c518a3591616097eba # Parent d298433f2ef542631172507be9e03b5f565582da verstehe den code so besser (hoffentlich) diff -r d298433f2ef5 -r f38791e4991c tele-watch.pl --- a/tele-watch.pl Wed Feb 18 14:06:16 2015 +0100 +++ b/tele-watch.pl Fri Feb 20 15:32:54 2015 +0100 @@ -56,19 +56,26 @@ my ($uid, $gid, $mode) = (stat $dir)[4, 5, 2]; defined(my $pid = fork()) or die "Can't fork: $!\n"; if ($pid == 0) { + # avoid execution of END{ } blocks + $clean_pids{$$} = 1; chdir $dir or die "Can't chdir to $dir: $!\n"; system("bzr init"); finddepth(sub { chown($uid, $gid, $_); chmod($mode & 07777, $_); }, ".bzr"); - exec "true"; # avoid execution of END{ } blocks } wait; }, ); +my %clean_pids; + MAIN: { + + # avoid execution of END{ } blocks + $clean_pids{$$} = 1; + my @_ARGV = @ARGV; my %TARGET; @@ -128,6 +135,9 @@ # cleanup code END { + + return if delete $clean_pids{$$}; + foreach (keys %TARGET) { if (readf("$_/.watched") || 0 == $$) { unlink "$_/.watched"; @@ -163,9 +173,7 @@ open(STDOUT, ">/dev/null") or die "Can't redir STDOUT: $!\n"; defined(my $pid = fork()) or die "Can't fork: $!\n"; if ($pid) { - %TARGET = (); notice "child is $pid"; - $opt_pidfile = ""; exit 0; } setsid();