X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.5 required=5.0	tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
Date: Mon, 16 Jan 2012 08:21:21 +0400
Message-ID: <CAJOtW+6mu8JDmyBsXGbWc_emnVRJMuJDSC7W4jzPPWwan3xp+g@mail.gmail.com>
Subject: system() not working outside of Cygwin environment
From: Yuri Gribov <tetra2005@googlemail.com>
To: cygwin@cygwin.com
Content-Type: multipart/mixed; boundary=0016e6d2616cfb5b3804b69d8b80
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

--0016e6d2616cfb5b3804b69d8b80
Content-Type: text/plain; charset=ISO-8859-1

Hi all,

Perhaps this is very basic but I was not able to find the answer in faq/docs.

Attached is a nice small program which does system("cmd /?"); The call
works pretty well when I run it from Cygwin environment. In my
situation I need to run standalone Cygwin programs (i.e. simply from
Windows cmd.exe). In this case the program fails - system() does not
seem to find cmd.exe and returns -1 (yes, cygwin1.dll is on PATH). If
I change system() to good old CreateProcess() everything runs fine. My
questions:
1) what is the reason for this behavior?
2) can I somehow alter the argument to system() to make it working? Or
perhaps modify PATH or any other environment variable before running
Cygwin program?

Thanks in advance,
Yuri

--0016e6d2616cfb5b3804b69d8b80
Content-Type: text/plain; charset=US-ASCII; name="gcc.txt"
Content-Disposition: attachment; filename="gcc.txt"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_gxgzl9jm0

I2luY2x1ZGUgPHN0ZGxpYi5oPg0KI2luY2x1ZGUgPHN0ZGlvLmg+DQoNCmlu
dCBtYWluKCkgew0KCWNoYXIgdG1wWzI1Nl07DQoJZ2V0Y3dkKHRtcCwgc2l6
ZW9mKHRtcCkpOw0KCXByaW50ZigiQ3dkOiAlc1xuIiwgdG1wKTsNCg0KCWlm
KCAwICE9IHN5c3RlbSgiY21kIC8/IikgKSB7DQoJCXByaW50ZigiRmFpbGVk
XG4iKTsNCgl9DQoNCglyZXR1cm4gMDsNCn0NCg0K


--0016e6d2616cfb5b3804b69d8b80
Content-Type: text/plain; charset=us-ascii

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
--0016e6d2616cfb5b3804b69d8b80--
