| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT 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 AT googlemail DOT com> |
| To: | cygwin AT cygwin DOT com |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT 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--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |