summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dunstan2025-01-08 15:56:12 +0000
committerAndrew Dunstan2025-01-08 15:56:12 +0000
commitb20fe54c9c2194fec65db73b2778a014e7823ae0 (patch)
tree58bd7562b8283f3f8bd71fe4241e9f777be399a3
parent7b27f5fd36cb3270e8ac25aefd73b552663d1392 (diff)
Set exit status for pgindent if pg_bsd_indent fails
Also document the exit codes in the script. The new exit code is 3, and is not overridden by the exit code set in --check mode. Author: Ashutosh Bapat Discussion: https://postgr.es/m/CAExHW5sPRSiFeLdP-u1Fa5ba7YS2f0gvLjmKOobopKadJwQ_GQ@mail.gmail.com
-rwxr-xr-xsrc/tools/pgindent/pgindent10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent
index 37eb25d5a8..d8acce7e92 100755
--- a/src/tools/pgindent/pgindent
+++ b/src/tools/pgindent/pgindent
@@ -2,6 +2,13 @@
# Copyright (c) 2021-2025, PostgreSQL Global Development Group
+# Program to maintain uniform layout style in our C code.
+# Exit codes:
+# 0 -- all OK
+# 1 -- error invoking pgindent, nothing done
+# 2 -- --check mode and at least one file requires changes
+# 3 -- pg_bsd_indent failed on at least one file
+
use strict;
use warnings FATAL => 'all';
@@ -408,6 +415,7 @@ foreach my $source_filename (@files)
if ($source eq "")
{
print STDERR "Failure in $source_filename: " . $error_message . "\n";
+ $status = 3;
next;
}
@@ -428,7 +436,7 @@ foreach my $source_filename (@files)
if ($check)
{
- $status = 2;
+ $status ||= 2;
last unless $diff;
}
}