Web lists-archives.org

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




Quoting Paul Leder <sa212+mingw@xxxxxxxxxxx>:

>
> The problem is that I call 'system' and 'CreateProcess' to spawn child
> processes. These have different requirements for backslashes and quote
> characters depending on what shell they use. I specify the shell myself
> for 'CreateProcess' ('cmd /c' or '/bin/bash -c'), but I still need to
> know which shell to use. I also need to adjust the command line that I
> give to 'system'. I haven't tried the different ways of running bash. In
> development, I just use the basic console window; no tty or rxvt.
>

Check for the environment variable SHELL.  If it doesn't exist use the 
value of COMSPEC /c otherwise use the value of SHELL -c.

Earnie

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