I'm trying to start a process using Msys from a Python script on WinXP and
can't figure it out.
Normally I'd assume it's something like:
msys.exe whatever.exe -arg1 -arg2
The above would launch "whatever.exe -arg1 -arg2" from msys.exe.
But because msys launches with a batch file, I can't figure out how to do
Is there a way to do this?
From: Keith MARSHALL <keith.marshall@to...> - 2006-07-24 09:07:13
Alec Bennet wrote:
> I'm trying to start a process using Msys from a Python script
> on WinXP and can't figure it out.
What do you mean, "start a process using MSYS"? You start processes
using the standard system level interface provided by WinXP itself.
> Normally I'd assume it's something like:
> msys.exe whatever.exe -arg1 -arg2
Have you tried just `whatever.exe -arg1 -arg2'? That should work.
There is one caveat: if `whetever.exe' is MSYS aware, then you must
ensure that msys-1.0.dll can be found in your PATH, or in the same
directory as `whatever.exe'.
> The above would launch "whatever.exe -arg1 -arg2" from msys.exe.
There is no such thing as `msys.exe'.
> But because msys launches with a batch file, I can't figure out how
> to do that.
The purpose of that batch file is to launch `sh.exe', found in the
MSYS `bin' directory, as an interactive shell, from which you then
start other processes; it does nothing more, and, in particular, it
*doesn't* start MSYS processes, (other than the shell), as such.
> Is there a way to do this?
See above. If the command you are trying to invoke is too complex
for `cmd.exe', (which is what Win32's `system' call tries to use as
its CLI), then you can launch MSYS' `sh.exe' as a non-interactive
interpreter, to parse it:
c:\msys\1.0\bin\sh.exe -c 'whatever.exe -arg1 -arg2'
(substituting your correct Win32 path for sh.exe, of course). If you
need some special environment setup for `whatever.exe', you can even
use a sourced shell script to set it up:
c:\msys\1.0\bin\sh.exe -c '. myenv.sh; whatever.exe -arg1 -arg2'