diff options
author | Gurusamy Sarathy <gsar@engin.umich.edu> | 1997-05-24 19:50:36 +1200 |
---|---|---|
committer | Tim Bunce <Tim.Bunce@ig.co.uk> | 1997-06-11 12:00:00 +1200 |
commit | 174c211a66516a872d3a421681076bee9a56fa2b (patch) | |
tree | 8ae00041697ace94cfab27ea2877a03683b13be8 | |
parent | 490ab354c465618bcdee84ecc1d256c265518f0a (diff) | |
download | perl-174c211a66516a872d3a421681076bee9a56fa2b.tar.gz |
win32: user defined shell
This patch replaces the patch in win32.3 in the gnat collection.
The reasons for reworking that patch should be evident from
reading the patch below.
p5p-msgid: 199705291339.JAA21682@aatma.engin.umich.edu
-rw-r--r-- | pod/perlrun.pod | 11 | ||||
-rw-r--r-- | win32/win32.c | 21 |
2 files changed, 22 insertions, 10 deletions
diff --git a/pod/perlrun.pod b/pod/perlrun.pod index c4679e1def..de7116d939 100644 --- a/pod/perlrun.pod +++ b/pod/perlrun.pod @@ -567,6 +567,17 @@ The command used to load the debugger code. The default is: BEGIN { require 'perl5db.pl' } +=item PERL5SHELL (specific to WIN32 port) + +May be set to an alternative shell that perl must use internally for +executing "backtick" commands or system(). Perl doesn't use COMSPEC +for this purpose because COMSPEC has a high degree of variability +among users, leading to portability concerns. Besides, perl can use +a shell that may not be fit for interactive use, and setting COMSPEC +to such a shell may interfere with the proper functioning of other +programs (which usually look in COMSPEC to find a shell fit for +interactive use). + =item PERL_DEBUG_MSTATS Relevant only if your perl executable was built with B<-DDEBUGGING_MSTATS>, diff --git a/win32/win32.c b/win32/win32.c index 7fb04166c2..57e90a2a8c 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -317,18 +317,19 @@ IdOS(void) static char * GetShell(void) { - static char* szWin95ShellEntry = "Win95Shell"; - static char* szWin95DefaultShell = "Cmd32.exe"; - static char* szWinNTDefaultShell = "cmd.exe"; - if (!ProbeEnv) { + char* defaultshell = (IsWinNT() ? "cmd.exe" : "command.com"); + /* we don't use COMSPEC here for two reasons: + * 1. the same reason perl on UNIX doesn't use SHELL--rampant and + * uncontrolled unportability of the ensuing scripts. + * 2. PERL5SHELL could be set to a shell that may not be fit for + * interactive use (which is what most programs look in COMSPEC + * for). + */ + char *usershell = getenv("PERL5SHELL"); + ProbeEnv = TRUE; - if (IsWin95()) { - strcpy(szShellPath, szWin95DefaultShell); - } - else { - strcpy(szShellPath, szWinNTDefaultShell); - } + strcpy(szShellPath, usershell ? usershell : defaultshell); } return szShellPath; } |