From b20fe54c9c2194fec65db73b2778a014e7823ae0 Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Wed, 8 Jan 2025 10:56:12 -0500 Subject: [PATCH] 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 --- src/tools/pgindent/pgindent | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent index 37eb25d5a86..d8acce7e929 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; } } -- 2.39.5