This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Process Execution from Cygwin Shells

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?



Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]