Skip to content

Commit b20fe54

Browse files
committed
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
1 parent 7b27f5f commit b20fe54

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/tools/pgindent/pgindent

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
# Copyright (c) 2021-2025, PostgreSQL Global Development Group
44

5+
# Program to maintain uniform layout style in our C code.
6+
# Exit codes:
7+
# 0 -- all OK
8+
# 1 -- error invoking pgindent, nothing done
9+
# 2 -- --check mode and at least one file requires changes
10+
# 3 -- pg_bsd_indent failed on at least one file
11+
512
use strict;
613
use warnings FATAL => 'all';
714

@@ -408,6 +415,7 @@ foreach my $source_filename (@files)
408415
if ($source eq "")
409416
{
410417
print STDERR "Failure in $source_filename: " . $error_message . "\n";
418+
$status = 3;
411419
next;
412420
}
413421

@@ -428,7 +436,7 @@ foreach my $source_filename (@files)
428436

429437
if ($check)
430438
{
431-
$status = 2;
439+
$status ||= 2;
432440
last unless $diff;
433441
}
434442
}

0 commit comments

Comments
 (0)