Web lists-archives.org

Re: [Mingw-users] How can I tell whether my prog is running on cmd.exe or bash?




On Thursday 07 February 2008 18:04, Paul Leder wrote:
> PATH generally also contains lots of cruft. My current plan Z is
> (I've just posted this on the cygwin list, where Greg suggested uname
> and did some test code):
>
> if(
>     (system(uname) looks sane) &&
>     (system(cygpath -m /bin/sh) returns success))
>       use CreateProcess with /bin/sh path returned by cygpath;
>   else
>       use CreateProcess with cmd.exe /c

Yuck!!!  That has to do a PATH search anyway, to find first uname, and 
then cygpath.  Furthermore, it *only* works when the Unixy shell is of 
the Cygwin variety; what if your user has some other Unixy shell, and 
would expect that to be used?

If you are trying to support a native Woe32 build, (which would appear 
to be the objective when using MinGW), why bother.  Unless you *really* 
need some Unixy shell feature, what is the point in looking for one; 
just use `system( "command to be executed by cmd.exe" )' 
unconditionally.

OTOH, if you *do* need a Unixy shell, then why require it to be 
Cygwin's?  If you do that, then why use MinGW at all?  Just build your 
application entirely with, and for Cygwin.  If you need a Unixy shell, 
*and* you want native behaviour *without* insisting on Cygwin, then the 
code you need is already in MinGW's exec wrappers library.

Regards,
Keith.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users