summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian2004-11-06 04:29:40 +0000
committerBruce Momjian2004-11-06 04:29:40 +0000
commit7ba377431efad1466d214eb11b50c3791d5f06a5 (patch)
tree73d28be583252fa34600bc54e5972b5432855b85
parentd2f6c3e56cbd67f0ec3a949a801df6fb4f3a1cf4 (diff)
Tests for COMSPEC in the right place and supply a reasonable shell
default on Win32.
-rw-r--r--src/bin/psql/command.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index ef70d3b62ca..e1a76001ed1 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2004, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.130 2004/11/04 22:25:14 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.131 2004/11/06 04:29:40 momjian Exp $
*/
#include "postgres_fe.h"
#include "command.h"
@@ -1525,7 +1525,11 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
+#ifndef WIN32
#define DEFAULT_SHELL "/bin/sh"
+#else
+#define DEFAULT_SHELL "c:/windows/system32/cmd.exe"
+#endif
static bool
do_shell(const char *command)
@@ -1537,11 +1541,11 @@ do_shell(const char *command)
char *sys;
const char *shellName = NULL;
+ shellName = getenv("SHELL");
#ifdef WIN32
- shellName = getenv("COMSPEC");
-#endif
if (shellName == NULL)
- shellName = getenv("SHELL");
+ shellName = getenv("COMSPEC");
+#endif
if (shellName == NULL)
shellName = DEFAULT_SHELL;