Files
astronomy/generate/jplcheck.bat
Don Cross 7e196a3c17 Fixed Windows batch files ignoring negative integer failure codes.
In many of my Windows batch files, I used the following
construct to detect failures:

    do_something
    if errorlevel 1 (
        echo.An error occurred in do_something
        exit /b 1
    )

I discovered that it is possible for a Windows program
to exit with a negative integer error code.
This causes the above construct to miss the failure
and the batch file blithely continues.

So I have replaced that construct with

    do_something || (
        echo.An error occurred in do_something
        exit /b 1
    )

This way, if the command exits with any nonzero error,
we correctly detect it as a failure.
2023-02-26 10:26:42 -05:00

16 lines
385 B
Batchfile

@echo off
setlocal EnableDelayedExpansion
if exist jpl_summary.txt (del jpl_summary.txt)
for %%f in (horizons\*.txt) do (
node jpl_horizons_check.js %%f > summary.txt || exit /b 1
type summary.txt
type summary.txt >> jpl_summary.txt
del summary.txt
)
node jpl_horizons_check.js tally jpl_summary.txt || exit /b 1
del jpl_summary.txt
echo.jplcheck: Finished
exit /b 0