psql \! WIN32 cleanup

Started by Bruce Momjianover 21 years ago7 messagespatches
Jump to latest
#1Bruce Momjian
bruce@momjian.us

The attached applied patch tests for COMSPEC in the right place and
supplies a reasonable shell default on Win32.

-- 
  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

Attachments:

/bjm/difftext/plainDownload+8-5
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#1)
Re: psql \! WIN32 cleanup

Bruce Momjian <pgman@candle.pha.pa.us> writes:

The attached applied patch tests for COMSPEC in the right place and
supplies a reasonable shell default on Win32.

+ #define DEFAULT_SHELL "c:/windows/system32/cmd.exe"

Is it really a good idea to assume that the Windows installation is on
drive C: ?

(This is an honest question, not a rhetorical one. I dunno whether
inserting the C: is better than leaving it off. I can think of cases
where either way will break, but I'm unsure what's most likely in
practice.)

regards, tom lane

#3Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#2)
Re: [PATCHES] psql \! WIN32 cleanup

Tom Lane wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

The attached applied patch tests for COMSPEC in the right place and
supplies a reasonable shell default on Win32.

+ #define DEFAULT_SHELL "c:/windows/system32/cmd.exe"

Is it really a good idea to assume that the Windows installation is on
drive C: ?

(This is an honest question, not a rhetorical one. I dunno whether
inserting the C: is better than leaving it off. I can think of cases
where either way will break, but I'm unsure what's most likely in
practice.)

Not sure. Should we just do "/windows/system32/cmd.exe" and leave off
the C:? The previous default was "/bin/sh" and that certainly will not
work on Win32.

-- 
  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
#4John A Meinel
john@johnmeinel.com
In reply to: Bruce Momjian (#3)
Re: [PATCHES] psql \! WIN32 cleanup

Bruce Momjian wrote:

Tom Lane wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

The attached applied patch tests for COMSPEC in the right place and
supplies a reasonable shell default on Win32.

+ #define DEFAULT_SHELL "c:/windows/system32/cmd.exe"

Is it really a good idea to assume that the Windows installation is on
drive C: ?

(This is an honest question, not a rhetorical one. I dunno whether
inserting the C: is better than leaving it off. I can think of cases
where either way will break, but I'm unsure what's most likely in
practice.)

Not sure. Should we just do "/windows/system32/cmd.exe" and leave off
the C:? The previous default was "/bin/sh" and that certainly will not
work on Win32.

Do you need to supply the full path to the executable? Because if it is
in the system PATH, then it should be found, and you can just do:

#define DEFAULT_SHELL "cmd.exe"

Or, if you allow environment variables, then something like:

#define DEFAULT_SHELL "$WINDIR/system32/cmd.exe"

is probably the way to go.

John
=:->

#5Gaetano Mendola
mendola@bigfoot.com
In reply to: Bruce Momjian (#3)
Re: psql \! WIN32 cleanup

Bruce Momjian wrote:

Tom Lane wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

The attached applied patch tests for COMSPEC in the right place and
supplies a reasonable shell default on Win32.

+ #define DEFAULT_SHELL "c:/windows/system32/cmd.exe"

Is it really a good idea to assume that the Windows installation is on
drive C: ?

(This is an honest question, not a rhetorical one. I dunno whether
inserting the C: is better than leaving it off. I can think of cases
where either way will break, but I'm unsure what's most likely in
practice.)

Not sure. Should we just do "/windows/system32/cmd.exe" and leave off
the C:? The previous default was "/bin/sh" and that certainly will not
work on Win32.

I think another path to try if COMSPEC is not defined is:

%SystemRoot%/system32/cmd.exe

Regards
Gaetano Mendola

#6Dave Page
dpage@pgadmin.org
In reply to: Gaetano Mendola (#5)
Re: psql \! WIN32 cleanup

-----Original Message-----
From: pgsql-patches-owner@postgresql.org on behalf of Tom Lane
Sent: Sat 11/6/2004 5:30 AM
To: Bruce Momjian
Cc: PostgreSQL-patches
Subject: Re: [PATCHES] psql \! WIN32 cleanup

Bruce Momjian <pgman@candle.pha.pa.us> writes:

The attached applied patch tests for COMSPEC in the right place and
supplies a reasonable shell default on Win32.

+ #define DEFAULT_SHELL "c:/windows/system32/cmd.exe"

Is it really a good idea to assume that the Windows installation is on
drive C: ?

I think it's worse to assume the installation directory is "windows". On windows 2000 for example, the default is "winnt".
Probably the best default would simply be "cmd.exe" as it's invariably in the system path.

Regards, Dave

#7Bruce Momjian
bruce@momjian.us
In reply to: Dave Page (#6)
Re: psql \! WIN32 cleanup

Dave Page wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

The attached applied patch tests for COMSPEC in the right place and
supplies a reasonable shell default on Win32.

+ #define DEFAULT_SHELL "c:/windows/system32/cmd.exe"

Is it really a good idea to assume that the Windows installation is on
drive C: ?

I think it's worse to assume the installation directory is "windows". On windows 2000 for example, the default is "winnt".
Probably the best default would simply be "cmd.exe" as it's invariably in the system path.

Agreed. Done.

-- 
  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