On Tue, Sep 4, 2012 at 2:19 AM, J Decker <[email protected]> wrote:
> On Mon, Sep 3, 2012 at 7:50 PM, David Cole <[email protected]> wrote:
>> That's not a workaround, that's the solution. The quotes don't belong there.
>
> I dunno seems to be an application specific failure....

Python:

 c:\>set PATH=c:\Python;C:\Windows\system32;C:\Windows
 c:\>python -c "import subprocess; subprocess.call(['hg','--version'])"
 WindowsError: [Error 2] The system cannot find the file specified

 c:\>set PATH="C:\Program 
Files\Mercurial";c:\Python;C:\Windows\system32;C:\Windows
 c:\>python -c "import subprocess; subprocess.call(['hg','--version'])"
 WindowsError: [Error 2] The system cannot find the file specified

 c:\>set PATH=C:\Program 
Files\Mercurial;c:\Python;C:\Windows\system32;C:\Windows
 c:\>python -c "import subprocess; subprocess.call(['hg','--version'])"
 Mercurial Distributed SCM (version 2.1)

CMake:

 c:\>type test.cmake
 execute_process(COMMAND hg --version RESULT_VARIABLE failure)
 if(failure)
   message(STATUS "failed to run hg: ${failure}")
 endif()

 c:\>set PATH=c:\Program Files (x86)\CMake 
2.8\bin;C:\Windows\system32;C:\Windows
 c:\>cmake -P test.cmake
 -- failed to run hg: The system cannot find the file specified

 c:\>set PATH="C:\Program Files\Mercurial";c:\Program Files (x86)\CMake 
2.8\bin;C:\Windows\system32;C:\Windows
 c:\>cmake -P test.cmake
 -- failed to run hg: The system cannot find the file specified

 c:\>set PATH=C:\Program Files\Mercurial;c:\Program Files (x86)\CMake 
2.8\bin;C:\Windows\system32;C:\Windows
 c:\>cmake -P test.cmake
 Mercurial Distributed SCM (version 2.1)

If you use execute_process's RESULT_VARIABLE you can get the
real result of the process instead of just assuming success.
It will either be an integer return code or a message indicating
a problem launching the process.

-Brad
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to