Boost logo

Boost :

From: Rene Rivera (grafik.list_at_[hidden])
Date: 2004-09-25 23:06:14


Rene Rivera wrote:

> David Abrahams wrote:
>
>> Calling cw_env.bat may be needed in order to establish the PATH
>> needed to find the C++ runtime DLLs. If you eliminated that call,
>> maybe we need to find a way to do the same thing that doesn't mess up
>> the errorlevel.
>
>
> I talked with Stefan off-list and I think I have a solution to the
> problem. Hopefully it works and I'll commit the change :-)

OK. I believe the problem is now resolved. The problem is a "bug"
introduced in the cwenv.bat of CodeWarrior 9. There is now an additional
last action this script takes:

========
rem Not sure why we sometimes have errors...
set ERRORLEVEL=0
========

Doing that is just plain wrong. It forever sets the error from that
point forward. So any attempt to read the result value of any program
run afterwards will result in getting that zero back. And the Windows
documentation even warns about this (from >help set)...

========
If Command Extensions are enabled, then there are several dynamic
environment variables that can be expanded but which don't show up in
the list of variables displayed by SET. These variable values are
computed dynamically each time the value of the variable is expanded.
If the user explicitly defines a variable with one of these names, then
that definition will override the dynamic one described below:
========

So if you are one of the persons with CW9 I would suggest filling a bug
for this. To set the problem directly one can use this script:

========
call "cwenv.bat" -quiet
set "ERRORLEVEL="
echo =====%ERRORLEVEL%=====
dir q:\ >nul 2>nul
set status=%ERRORLEVEL%
echo =====%status%=====
dir c:\ >nul 2>nul
set status=%ERRORLEVEL%
echo =====%status%=====
========

Which has the workaround for the problem, the second line. Running it
will produce:

=====0=====
=====1=====
=====0=====

If you remove that second line the output becomes;

=====0=====
=====0=====
=====0=====

My suggestion for them to fix it is to use a command that is guaranteed
to succeed to clear the ERRORLEVEL like "cd >nul".

-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com - 102708583/icq

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk