delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/10/01/16:02:02

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Date: Fri, 01 Oct 2004 21:58:18 +0200
From: "Eli Zaretskii" <eliz AT gnu DOT org>
Sender: halo1 AT zahav DOT net DOT il
To: djgpp AT delorie DOT com
Message-ID: <01c4a7f1$Blat.v2.2.2$24f046e0@zahav.net.il>
X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 2.2.2
In-reply-to: <cjjc4u$2r6$1@nsnmpen3-gest.nuria.telefonica-data.net>
(rafael_no_spam_no_ AT geninfor DOT com)
Subject: Re: system() return value if no program present
References: <cielml$fln$1 AT nsnmpen3-gest DOT nuria DOT telefonica-data DOT net> <01c49d67$Blat.v2.2.2$625a64a0 AT zahav DOT net DOT il> <42da7100 DOT 0409200424 DOT 59601f01 AT posting DOT google DOT com> <01c49f48$Blat.v2.2.2$03122900 AT zahav DOT net DOT il> <42da7100 DOT 0409210019 DOT 1af1c09d AT posting DOT google DOT com> <01c4a00c$Blat.v2.2.2$f8f56520 AT zahav DOT net DOT il> <cjjc4u$2r6$1 AT nsnmpen3-gest DOT nuria DOT telefonica-data DOT net>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: "=?windows-1252?Q?Rafael_Garc=EDa?=@unknown.addr"
>  <rafael_no_spam_no_ AT geninfor DOT com>
> Date: Fri, 01 Oct 2004 12:37:33 +0200
> 
> I have found the same problem in another computer and I have found that 
> this only happens when an environment variable "SHELL" is defined. If I 
> undefined it, no interactive shell is launched.
> 
> set SHELL=
>    - system("grep")=2 and works as expected
>    - system("notexist")=0 and works as expected ("not found")
>    - system("dir")=0 and works as expected
> 
> set SHELL=cmd
>    - system("grep")=2 and works as expected
>    - system("notexist")=-1 and works as expected ("not found")
>    - system("dir")=-1 and it does nothing (why?)
> 
> set SHELL=c:\wtsrv\system32\cmd.exe    (correct path)
>    - system("grep")=2 and works as expected
>    - system("notexist") runs interactive shell and then returns 0 (why?)
>      (this was what begun my question)
>    - system("dir") runs interactive shell and then returns 0 (why?)

It seems that in DJGPP v2.03, cmd.exe is not treated as a DOS shell,
so `system' thinks it is a Unix-like shell.  That's a bug, I think.

Therefore, I suggest to set SHELL to command.com, not to cmd.exe.  Do
the problems go away in that case?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019