@ -80,6 +80,7 @@ typedef enum
static bool do_wait = false ;
static bool do_wait = false ;
static bool wait_set = false ;
static bool wait_set = false ;
static int wait_seconds = DEFAULT_WAIT ;
static int wait_seconds = DEFAULT_WAIT ;
static bool wait_seconds_arg = false ;
static bool silent_mode = false ;
static bool silent_mode = false ;
static ShutdownMode shutdown_mode = SMART_MODE ;
static ShutdownMode shutdown_mode = SMART_MODE ;
static int sig = SIGTERM ; /* default */
static int sig = SIGTERM ; /* default */
@ -1362,7 +1363,8 @@ pgwin32_CommandLine(bool registration)
if ( registration & & do_wait )
if ( registration & & do_wait )
appendPQExpBuffer ( cmdLine , " -w " ) ;
appendPQExpBuffer ( cmdLine , " -w " ) ;
if ( registration & & wait_seconds ! = DEFAULT_WAIT )
/* Don't propagate a value from an environment variable. */
if ( registration & & wait_seconds_arg & & wait_seconds ! = DEFAULT_WAIT )
appendPQExpBuffer ( cmdLine , " -t %d " , wait_seconds ) ;
appendPQExpBuffer ( cmdLine , " -t %d " , wait_seconds ) ;
if ( registration & & silent_mode )
if ( registration & & silent_mode )
@ -2151,6 +2153,7 @@ main(int argc, char **argv)
{ NULL , 0 , NULL , 0 }
{ NULL , 0 , NULL , 0 }
} ;
} ;
char * env_wait ;
int option_index ;
int option_index ;
int c ;
int c ;
pgpid_t killproc = 0 ;
pgpid_t killproc = 0 ;
@ -2202,6 +2205,10 @@ main(int argc, char **argv)
}
}
# endif
# endif
env_wait = getenv ( " PGCTLTIMEOUT " ) ;
if ( env_wait ! = NULL )
wait_seconds = atoi ( env_wait ) ;
/*
/*
* ' Action ' can be before or after args so loop over both . Some
* ' Action ' can be before or after args so loop over both . Some
* getopt_long ( ) implementations will reorder argv [ ] to place all flags
* getopt_long ( ) implementations will reorder argv [ ] to place all flags
@ -2271,6 +2278,7 @@ main(int argc, char **argv)
break ;
break ;
case ' t ' :
case ' t ' :
wait_seconds = atoi ( optarg ) ;
wait_seconds = atoi ( optarg ) ;
wait_seconds_arg = true ;
break ;
break ;
case ' U ' :
case ' U ' :
if ( strchr ( optarg , ' \\ ' ) )
if ( strchr ( optarg , ' \\ ' ) )