[Scons-users] env.command fails on mingw shell

Dmitry Mikhin dmitry.mikhin at gmail.com
Thu Oct 25 17:30:52 EDT 2012


The "env.Command" on MinGW would be executed under cmd.exe shell, not
MinGW shell.

Thus, "ls; ls -l" works from the prompt but not from scons. To join
commands in "env.Command" use the "&&" separator, not ";". Also, as
"ls" is not a DOS command, it will fail unless c:\MinGW\bin and
c:\MinGW\msys\1.0\bin (writing by memory, check it!) are in the DOS
path. Also, beware variable substitutions, e.g. as in

"path=%s;%%path%%&& dir" % added_path

Note the (lack of) space: the more natural

"path=%s;%%path%% && dir" % added_path

would have a space at the end of the path and routines in "added_path"
won't be found.

I have a reasonably complex build running on both Linux and MinGW, ask
if you face more issues.

Yours,
Dmitry


> I'm running mingw shell and Scons. If I run this short example

>

> import os

> env = Environment(ENV = {'PATH' : os.environ["PATH"]})

> env.Command("test", "", "cd an_existing_directory;")

>

> the env.Command line breaks with an error "the system can not found the path"

> If you remove the semicolon in the command line to

>

> env.Command("test", "", "cd an_existing_directory")

>

> the script is run without errors. It seems the semicolon creates a problem on mingw and env.Command;

> (other command like "ls; ls -l" does not work although, on mingw command line the commands work without any problem)



More information about the Scons-users mailing list