Skip to content

Commit 7ba3774

Browse files
committed
Tests for COMSPEC in the right place and supply a reasonable shell
default on Win32.
1 parent d2f6c3e commit 7ba3774

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/bin/psql/command.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2004, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.130 2004/11/04 22:25:14 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.131 2004/11/06 04:29:40 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "command.h"
@@ -1525,7 +1525,11 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
15251525

15261526

15271527

1528+
#ifndef WIN32
15281529
#define DEFAULT_SHELL "/bin/sh"
1530+
#else
1531+
#define DEFAULT_SHELL "c:/windows/system32/cmd.exe"
1532+
#endif
15291533

15301534
static bool
15311535
do_shell(const char *command)
@@ -1537,11 +1541,11 @@ do_shell(const char *command)
15371541
char *sys;
15381542
const char *shellName = NULL;
15391543

1544+
shellName = getenv("SHELL");
15401545
#ifdef WIN32
1541-
shellName = getenv("COMSPEC");
1542-
#endif
15431546
if (shellName == NULL)
1544-
shellName = getenv("SHELL");
1547+
shellName = getenv("COMSPEC");
1548+
#endif
15451549
if (shellName == NULL)
15461550
shellName = DEFAULT_SHELL;
15471551

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy