delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/10/01/06:45:41

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "=?windows-1252?Q?Rafael_Garc=EDa?=@unknown.addr"
<rafael_no_spam_no_ AT geninfor DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: system() return value if no program present
Date: Fri, 01 Oct 2004 12:37:33 +0200
Organization: Telefonica Data Espagna
Lines: 30
Message-ID: <cjjc4u$2r6$1@nsnmpen3-gest.nuria.telefonica-data.net>
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>
NNTP-Posting-Host: 100.red-80-34-252.pooles.rima-tde.net
Mime-Version: 1.0
X-Trace: nsnmpen3-gest.nuria.telefonica-data.net 1096627166 2918 80.34.252.100 (1 Oct 2004 10:39:26 GMT)
X-Complaints-To: usenet AT nsnmpen3-gest DOT nuria DOT telefonica-data DOT net
NNTP-Posting-Date: Fri, 1 Oct 2004 10:39:26 +0000 (UTC)
User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207)
X-Accept-Language: es-es, es
In-Reply-To: <01c4a00c$Blat.v2.2.2$f8f56520@zahav.net.il>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
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

Eli Zaretskii escribió:
>>>>When executed in my system I find myself in a new shell:
>>>>
>>>>Microsoft Windows XP [Versin 5.1.2600]
>>>>(C) Copyright 1985-2001 Microsoft Corp.
>>>>
>>>>c:\c>
>>>

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

Thank you

- Raw text -


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