Move Cluster.pm initialization code to a more obvious place
authorAndrew Dunstan <[email protected]>
Sun, 6 Oct 2024 14:34:45 +0000 (10:34 -0400)
committerAndrew Dunstan <[email protected]>
Sun, 6 Oct 2024 14:34:45 +0000 (10:34 -0400)
Commit 460c0076e8 added some module intialization code to set signal
handlers. However, that code has now become somewhat buried, as later
commits added new subroutines. Therefore, move the initialization code
to the module's INIT block where it won't become obscured.

src/test/perl/PostgreSQL/Test/Cluster.pm

index 90a842f96ab0bee16d5912a162e8a38f1a36615c..30857f34bffbd006745601b3e40fd44a22babb88 100644 (file)
@@ -175,6 +175,11 @@ INIT
    $portdir =~ s!\\!/!g;
    # Make sure the directory exists
    mkpath($portdir) unless -d $portdir;
+
+   #
+   # Signal handlers
+   #
+   $SIG{TERM} = $SIG{INT} = sub { die "death by signal"; };
 }
 
 =pod
@@ -3350,13 +3355,6 @@ sub corrupt_page_checksum
    return;
 }
 
-#
-# Signal handlers
-#
-$SIG{TERM} = $SIG{INT} = sub {
-   die "death by signal";
-};
-
 =pod
 
 =item $node->log_standby_snapshot(self, standby, slot_name)