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: PATHEXT is fundamental to Windows and Should be recognised by CYGWIN

On Aug 10 03:44, Andrey Repin wrote:
> Greetings, Corinna Vinschen!
> >> As for PATHEXT we can do the following scenario instead.
> >> 
> >> export PATHEXT="$PATHEXT;.TXT"
> >> vi foo.txt
> >> :set ff=dos
> >> i
> >> a
> >> b
> >> c
> >> <ESC>
> >> :wq
> >> cmd /c foo
> > As you show here, the PATHEXT definition is so that it also contains
> > file suffixes which require to know the interpreters starting them.  To
> > implement that, the lib would have to either read the registry to know
> > the connection between suffix and interpreter (which is pretty
> > convoluted), or it would have to "start the file", aka call ShellExecute
> > on the file, without knowing what process will come up as child process.
> > In your example that would be Notepad or Write.
> > The way this works is just not feasible to be used from inside the DLL,
> > e.g.:
> > - ShellExecute does not return a handle to the called process, so the
> >   parent can't wait(2) for it.
> ShellExecuteEx does, but it will not help you a single bit.
> > - ShellExecute does not allow to specify an environment for the child
> >   process.  Cygwin's Windows environment is reduced to minimal size.
> >   Cygwin children inherit the POSIX environment by a simple copy
> >   process.  Only when starting a non-Cygwin process, this process gets
> >   a full Windows environment by means of the matching CreateProcess
> >   parameter.
> ShellExecuteEx does, but…
> > So, if we actually implement PATHEXT, its usage would be limited to
> > suffixes of binary files and files starting with #!<interpreter>, or we
> > would have to use a way to start an application which doesn't work well
> > in a POSIX scenario, or we would have to search the registry for the
> > suffix linkage.  Additionally to searching a variable number of files
> > for each single file access.
> > Additionally I would (again?) like to stress that PATHEXT is a feature
> > of CMD, aka, the shell.  It's not a feature of the underlying libs.
> Add to that, ShellExecute(Ex) can't bind to the current console.
> Even if the starting program is a console app, it will, always, create a new
> console.

Plus, any kind of IO redirection won't work.

Sorry, but I won't implement anything like this in the DLL.  It's just
not what the DLL is for.  If you want to start any kind of file like
this, use "cygstart".  That's what it has been made for.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: signature.asc
Description: PGP signature

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