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
# 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';
if ($source eq "")
{
print STDERR "Failure in $source_filename: " . $error_message . "\n";
+ $status = 3;
next;
}
if ($check)
{
- $status = 2;
+ $status ||= 2;
last unless $diff;
}
}