Page 1 of 1
Unappropriated errorlevel when built from command line
Posted: Mon 15 Apr 2013 08:14
by serge_t
Hello,
Building UniDAC 4.5.9 05-Sep-12 from sources (Delphi 7, Win XP SP3) produces unappropriated errorlevel > 0 when no errors occurred.
To check it create make2.bat in "Source\Delphi7"
Code: Select all
@echo off
call Make.bat
if errorlevel 1 (
echo.Errors occurred
) else (
echo.OK
)
The problem may be in "popd" command. If you modify main "Source\make.bat" by adding exit 0 all is ok.
Re: Unappropriated errorlevel when built from command line
Posted: Mon 15 Apr 2013 10:02
by AlexP
hello,
Our bat file doesn't return errors, you can check this by adding the errorlevel check after the lilnes:
Code: Select all
:end
popd
rem Add
if errorlevel 1 (
echo.Errors occurred
) else (
echo.OK
)
This behaviour is due to the cmd interpreter. This can be seen by creating a simple bat file with the following commands:
and run it from your bat file
Re: Unappropriated errorlevel when built from command line
Posted: Mon 15 Apr 2013 11:17
by serge_t
Please run it from
your Make.bat located in Source\Delphi7 to see the problem:
Code: Select all
@echo off
rem **********************************************************************
rem *
rem * Unidac for Delphi 7
rem *
rem **********************************************************************
rem --- Win64 compatibility ---
if "%ProgramFiles(x86)%"=="" goto DoWin32
set PROGRAMFILES=%ProgramFiles(x86)%
:DoWin32
set IdeDir="%PROGRAMFILES%\Borland\Delphi7
call ..\Make.bat Delphi 7
if errorlevel 1 (
echo.Errors occurred
) else (
echo.OK
)
What exactly is the option you mean?
We used default options set up by Windows only.
And simple "exit /b 0" prevent yours BATs from getting any of this kind of problems.
This problem blocked us including UniDAC compilation by makefile.
Re: Unappropriated errorlevel when built from command line
Posted: Wed 17 Apr 2013 10:44
by AlexP
Hello,
There is no reason to reset errorlevel, since we check this variable after each operation in our BAT file, and if there is any error, script execution will be terminated, an error message will be shown, and the script will wait for pressing any button. Therefore, if you invoke our file from your own one, there is no need to check errorlevel after execution of our script.
Re: Unappropriated errorlevel when built from command line
Posted: Wed 17 Apr 2013 11:00
by serge_t
AlexP wrote:There is no reason to reset errorlevel, since we check this variable after each operation in our BAT file, and if there is any error, script execution will be terminated, an error message will be shown, and the script will wait for pressing any button.
So, your script cannot be included in automatic build system (continuous integration) because of waiting input in case of any error?
AlexP wrote:Therefore, if you invoke our file from your own one, there is no need to check errorlevel after execution of our script.
I'll be glad to believe what your script is never failed. However, the normal practice is to assure it.
Re: Unappropriated errorlevel when built from command line
Posted: Wed 17 Apr 2013 12:41
by AlexP
Hello,
We didn't provide for the use of our script from other scripts or applications, the script is designed to be used by end-user and to simplify package build. Therefore, on script execution error, the pause method is interrupted and invoked in order for the error reason to be seen. If you need to embed your script to yours, you can edit it by yourself in any way.
Re: Unappropriated errorlevel when built from command line
Posted: Wed 17 Apr 2013 13:42
by serge_t
Ok, now it's clear.