Improve shutdown logic in mock syslog server
authorJacob Bachmeyer <jcb@gnu.org>
Sat, 27 Feb 2021 03:36:10 +0000 (21:36 -0600)
committerJacob Bachmeyer <jcb@gnu.org>
Sat, 27 Feb 2021 03:36:10 +0000 (21:36 -0600)
testsuite/lib/exec/minlogd.pl

index 88b1483ab93afa6300a53f170085eb86721f7a14..e018f2997efefff6a07d50af30b7e02595538993 100755 (executable)
@@ -100,8 +100,7 @@ sub handle_command ($) {
   chomp $command;
 
   if ($command eq 'exit') {
-    print "minlogd: shutting down\n";
-    cleanup; exit
+    $Running = 0;
   }
 }
 
@@ -191,9 +190,10 @@ do {
   accumulate_command if vec($Rrdy, (fileno STDIN), 1);
 
   # wait for input
-  select $Rrdy=$Rchk, undef, undef, undef;
+  select $Rrdy=$Rchk, undef, undef, undef if $Running;
 } while ($Running);
 
+print "minlogd: shutting down\n";
 cleanup;
 exit;