Re: pg_ctl strangeness under msys

Bruce Momjian <[email protected]>
Newsgroups gmane.comp.db.postgresql.devel.win32
Message-ID <[email protected]>
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
  [email protected]               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org
/bjm/diff (text/plain, 1.4 KB)
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)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.