Re: [BUGS] "pg_ctl -w" does not return a failure exit code when postmaster - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: [BUGS] "pg_ctl -w" does not return a failure exit code when postmaster
Date
Msg-id 200412211738.iBLHctP04500@candle.pha.pa.us
Whole thread Raw
List pgsql-patches
Steve McWilliams wrote:
> I have noticed on linux that if you try to start postmaster via "pg_ctl
> -w", but the postmaster fails to run (e.g. if you forgot to create
> PGDATA), it returns a 0 exit code.  It needs to return a non-0 exit code
> if postmaster failed to start, when you are using the "-w" option to wait
> for it to start.

OK, this small applied patch fixes the problem.  pg_ctl.c is a new file
in 8.0 so we didn't hit all the return values correctly on our first
try.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/bin/pg_ctl/pg_ctl.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/pg_ctl/pg_ctl.c,v
retrieving revision 1.49
diff -c -c -r1.49 pg_ctl.c
*** src/bin/pg_ctl/pg_ctl.c    6 Dec 2004 01:09:20 -0000    1.49
--- src/bin/pg_ctl/pg_ctl.c    21 Dec 2004 17:34:26 -0000
***************
*** 582,588 ****
--- 582,591 ----
          print_msg(_("waiting for postmaster to start..."));

          if (test_postmaster_connection() == false)
+         {
              printf(_("could not start postmaster\n"));
+             exit(1);
+         }
          else
          {
              print_msg(_(" done\n"));

pgsql-patches by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Update for french pg_resetxlog.po file
Next
From: Bruce Momjian
Date:
Subject: Re: [BUGS] Problems with "-w" option on pg_ctl.exe running as a windows