Re: pg_ctl strangeness under msys - Mailing list pgsql-hackers-win32

From Bruce Momjian
Subject Re: pg_ctl strangeness under msys
Date
Msg-id 200410271943.i9RJhtx01465@candle.pha.pa.us
Whole thread Raw
In response to Re: pg_ctl strangeness under msys  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers-win32
Andrew Dunstan wrote:
> >Have you tried:
> >
> >    pg_ctl start 2>/dev/tty
> >
> >that would force stderr to go to the tty.  This might help because the
> >pg_ctl.c test is:
> >
> >        if (!isatty(fileno(stderr)))    /* Running as a service */
> >
> >  
> >
> 
> This was about status, not start.
> 
>   pg_ctl status 2>/dev/tty
> 
> gives me the same thing as before. But only if the postmaster isn't 
> running - if it is running I get the status as expected, because then we 
> write to stdout rather than calling write_stderr() - I'm not sure I 
> understand why we do that.

Yes, that is a bug that is fixed with the applied patch.  We should
alway print status to stdout, even stopped status.  We did that in 7.4
and should continue with that in 8.0.

-- 
  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.43
diff -c -c -r1.43 pg_ctl.c
*** src/bin/pg_ctl/pg_ctl.c    27 Oct 2004 17:17:07 -0000    1.43
--- src/bin/pg_ctl/pg_ctl.c    27 Oct 2004 19:43:01 -0000
***************
*** 767,786 ****
      pid = get_pgpid();
      if (pid == 0)                /* no pid file */
      {
!         write_stderr(_("%s: neither postmaster nor postgres running\n"), progname);
          exit(1);
      }
      else if (pid < 0)            /* standalone backend */
      {
          pid = -pid;
!         fprintf(stdout, _("%s: a standalone backend \"postgres\" is running (PID: %ld)\n"), progname, pid);
      }
      else
      /* postmaster */
      {
          char      **optlines;
  
!         fprintf(stdout, _("%s: postmaster is running (PID: %ld)\n"), progname, pid);
  
          optlines = readfile(postopts_file);
          if (optlines != NULL)
--- 767,786 ----
      pid = get_pgpid();
      if (pid == 0)                /* no pid file */
      {
!         printf(_("%s: neither postmaster nor postgres running\n"), progname);
          exit(1);
      }
      else if (pid < 0)            /* standalone backend */
      {
          pid = -pid;
!         printf(_("%s: a standalone backend \"postgres\" is running (PID: %ld)\n"), progname, pid);
      }
      else
      /* postmaster */
      {
          char      **optlines;
  
!         printf(_("%s: postmaster is running (PID: %ld)\n"), progname, pid);
  
          optlines = readfile(postopts_file);
          if (optlines != NULL)

pgsql-hackers-win32 by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: pg_ctl strangeness under msys
Next
From: Bruce Momjian
Date:
Subject: Re: Win32 open items