X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Thu, 10 May 2012 20:38:33 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Cygwin passes through null writes to other software when redirecting standard input/output (i.e. piping) Message-ID: <20120510183833.GC13090@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <20120427143753 DOT GO25385 AT calimero DOT vinschen DOT de> <025501cd24c6$6a353990$3e9facb0$@motionview3d.com> <4F9B38FB DOT 9030607 AT dancol DOT org> <20120428052727 DOT GA23749 AT ednor DOT casa DOT cgf DOT cx> <4F9BD262 DOT 2000403 AT dancol DOT org> <4FAABEAE DOT 7000309 AT tlinx DOT org> <053b01cd2e18$f3f9ce60$dbed6b20$@motionview3d.com> <20120509201147 DOT GD22015 AT ednor DOT casa DOT cgf DOT cx> <054d01cd2ec9$e6f4f5d0$b4dee170$@motionview3d.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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 May 10 13:57, Earnie Boyd wrote: > On Thu, May 10, 2012 at 12:28 PM, James Johnston wrote: > > Forgive me for asking perhaps a dumb question, but I was reading the page at > > http://cygwin.com/cygwin-ug-net/setup-env.html and wasn't too sure what was > > meant by the sentence "All Windows environment variables are imported when > > Cygwin starts" - which I assume includes parsing and using CYGWIN option? > > Is it: (1) the variables are processed the first time CYGWIN1.DLL is loaded > > into a process, and then never used again thereafter, or (2) every time a > > process linking with CYGWIN1.DLL loads - even if CYGWIN1.DLL is concurrently > > loaded by someone else?  I would assume it is #2.... > > > > Or to phrase another way: does Cygwin "start" once when the first process > > linking to it is loaded, or does it "start" every time a process loads?  (I > > realize Cygwin has extensive IPC and shared memory mechanisms, some of which > > is probably done only on first load of first process to initialize shared > > memory, which is what prompted this question.) > > IIRC Cygwin processes the Windows environment upon initial parent > process load and stores it internally for each parent process. Child > processes inherit the environment of the parent. So if I start to > shell command windows both look the same on start-up but if I modify > one of the environments in one command window the other is unaffected. > If I start a process in the changed environment then the subsequent > process will have the changed environment. That has nothing to do with Cygwin. This is just how the environment is handled in general. Child processes inherit it from their parent processes, regardless whether on Windows or Unix. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- 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