delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/06/18/04:44:07

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Wed, 18 Jun 2008 10:43:35 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Cygwin app not receiving modified PATH env var
Message-ID: <20080618084333.GA20180@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20080617034152 DOT GD7632 AT samus DOT subfocal DOT net> <20080618010536 DOT GE7632 AT samus DOT subfocal DOT net>
MIME-Version: 1.0
In-Reply-To: <20080618010536.GE7632@samus.subfocal.net>
User-Agent: Mutt/1.5.16 (2007-06-09)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On Jun 17 21:05, Mike Mueller wrote:
> On Mon, Jun 16, 2008 at 11:41:52PM -0400, Mike Mueller wrote:
> > I have a program (native win32) that is capable of launching
> > sub-processes, using apr (apache portable runtime), which is essentially
> > a wrapper around CreateProcess in the Windows API.  My program creates a
> > modified environment (changes the PATH env var), and passes this new
> > environment to CreateProcess.
> > 
> > When I run a native Windows program, for example, a .bat script that
> > says "echo %PATH%", I see the correctly modified PATH env var.
> > 
> > When I run a Cygwin program, the PATH is the original unmodified path
> > (rephrased in cygwin format), maybe inherited from the parent process?
> > The modified PATH being passed to CreateProcess is not discovered by the
> > Cygwin app.
> 
> No thoughts on this?  How & when does Cygwin take a snapshot of the
> Windows environment?  I'm still trying to figure out how my modified
> environment is not being picked up...

Cygwin processes get their environment from the parent process, just
like any other process.  In case of having a Cygwin parent, it uses
another mechanism for environment inheritance, but if the parent is
a native process, it gets it env from a call to GetEnvironmentStrings.
There's no other way, really.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

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

- Raw text -


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