X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.3 required=5.0	tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_QL
X-Spam-Check-By: sourceware.org
To: cygwin@cygwin.com
From: Andrew DeFaria <Andrew@DeFaria.com>
Subject: Re: How do I run a program compiled in cygwin from a program that is running in a Windows CMD shell?
Date: Wed, 14 Sep 2011 22:24:25 -0700
Lines: 33
Message-ID: <j4s269$bg7$1@dough.gmane.org>
References: <loom.20110915T060405-768@post.gmane.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0.2) Gecko/20110906 Thunderbird/6.0.2
In-Reply-To: <loom.20110915T060405-768@post.gmane.org>
X-Stationery: 0.7.5
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@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

On 09/14/11 21:13, Ted Byers wrote:
> The program run, and works, but ...
>
> I have a perl program
Perl script...
> running from a WIndows CMD shell, that needs to somehow
> run it in bash (with my usual environment when I run the bash shell)
Why? Why does it need to run in bash? cmd and bash are just program 
launchers from the perspective of your Perl script.
> If I run bash, I invoke my program my program using './qlt' followed by almost
> a dozen commandline arguments. If I had compiled it using MSVC++, I could invoke it from my perl program using "my $op = `qlt a nb c args`;"
I'm assuming now that qlt is your "program", probably a C program, that 
you compile from either MVC++ or perhaps Cygwin - you are not clear here...
> How do I modify what is within perl's backticks so that qlt is invoked as a
> child in my normal bash environment?  Can it be done?
It can't be done. When Perl "executes" some thing in backticks it is 
invoked as a child of the Perl process, not the bash nor cmd process. 
Normally the Perl process is a child of either bash or cmd depending on 
which shell you used to launch your Perl process.
> I am not asking about building the program so it doesn't need to run within
> cygwin's bash.  I have other tools that let me do that if I must.  Rather, I
> want to make a child process that has the cygwin environemt even though the
> parent process does not.
In order to understand this you need to become cognizant as to exactly 
what Perl you are running when you run your Perl script. How exactly are 
you firing off this puppy?  Cygwin's Perl will run commands backticked 
through your shell (normally bash). ActiveState's Perl will run commands 
backticked through cmd. The two have vastly different semantics. So, 
what Perl are you running?
-- 
Andrew DeFaria <http://defaria.com>
Since light travels faster than sound, isn't that why some people appear 
bright until you hear them speak?


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

