delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/05/19/01:28:14

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <BANLkTimMDbvVwCCQJ+NeJ2T3qO9nK-J2jg@mail.gmail.com>
References: <BANLkTimMDbvVwCCQJ+NeJ2T3qO9nK-J2jg AT mail DOT gmail DOT com>
Date: Thu, 19 May 2011 06:27:54 +0100
Message-ID: <BANLkTi=aztXC2DaLB-6g-FSXUzTg2txStw@mail.gmail.com>
Subject: Re: Process Execution from Cygwin Shells
From: Andy Koppe <andy DOT koppe AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
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 19 May 2011 05:58, Sravan Bhamidipati wrote:
> Steps to reproduce:
> 1. Open "Process Monitor" and filter for events of type "Operation"
> and value "Process Create".
> 2. Open a Cygwin shell (using cygwin.bat or mintty or rxvt): bash or ksh, e.g.
> 3. Type any command that is not a shell built-in, say "clear" or "cmd".
> 4. Notice that "Process Monitor" captured two process creation events
> related to the invoked command: a new child shell and another of the
> invoked command.

The first is the shell forking itself, the second is the forked
process invoking exec() to run the new program.

> This seems very strange to me. The behavior applies even when
> executing a Shell script. I noticed identical behavior when using
> MinGW Shell as well.

No surprise there, since the MinGW Shell (i.e. MSYS) is little more
than an old Cygwin version.

> Shells in Unix-based OSs don't behave this way.

Yep, because there exec() doesn't create a new process, it just
replaces the program in the current process. Windows can't do that,
hence Cygwin has to emulate it by creating a new process.

> Can something be done about it?

Nope.

Andy

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

- Raw text -


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