Quantcast

ERRORLEVEL by texify

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ERRORLEVEL by texify

Daniele Giorgio Degiorgi
Hi,

 

I try to use following cmd file to generate a full recompilation

 

rem @echo off

rem %1 directory, %2 tex name, %3 dir name

cd K:/_BookList/Years/%1

texify --pdf  %2.tex <F:\texinp.txt >texify.log

if NOT ERRORLEVEL 0 goto lab1

MOVE %2.pdf M:\_Library\%3

goto lab2

:lab1

echo %1/%2 failed

:lab2

 

Where the file F:\texinp.txt just contains an x to quit.

 

If texify succeed, the generated pdf will be moved, but if it does not
succeed, it still returns errorlevel 0, while writing

 

Sorry, but texify did not succeed.

 

The log file hopefully contains the information to get MiKTeX going again:

 

  C:/Users/Daniele/AppData/Local/MiKTeX/2.9/miktex/log/texify.log

 

You may want to visit the MiKTeX project page, if you need help.

 

Is there a way to let texify set a non zero errorlevel in case of errors?

 

I tried to use --quiet instead of redirecting output, but still errorlevel
is set to 0 even in case of errors.

 

Many thanks for any hints,

 

Daniel

------------------------------------------------------------------------------
_______________________________________________
Q: How can I leave the mailing list?
A: See http://docs.miktex.org/faq/support.html#leavingml
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ERRORLEVEL by texify

David Allsopp
Daniele Giorgio Degiorgi wrote:

> Hi,
>
> I try to use following cmd file to generate a full recompilation
>
> rem @echo off
> rem %1 directory, %2 tex name, %3 dir name
> cd K:/_BookList/Years/%1
> texify --pdf  %2.tex <F:\texinp.txt >texify.log
> if NOT ERRORLEVEL 0 goto lab1
> MOVE %2.pdf M:\_Library\%3
> goto lab2
> :lab1
> echo %1/%2 failed
> :lab2
>
> Where the file F:\texinp.txt just contains an x to quit.
>
> If texify succeed, the generated pdf will be moved, but if it does not
> succeed, it still returns errorlevel 0, while writing
> Sorry, but texify did not succeed.

I don't use texify (I personally prefer to write Makefiles, rather than relying on magic commands), but I think you don't understand how errorlevel works - it is cumulative. If texify returns exit *code* 1, then you will have errorlevel 1 and errorlevel 0. If you want to use the actual exit code, you need to use %ERRORLEVEL% which is a number, e.g.

if %errorlevel% equ 1 goto lab1

Though I have no idea if texify actually sets exit codes on error (you can tell this by using echo %ERRORLEVEL%).

HTH,


David

------------------------------------------------------------------------------
_______________________________________________
Q: How can I leave the mailing list?
A: See http://docs.miktex.org/faq/support.html#leavingml
Loading...