[BUG] CLI Produces Same "ERRORLEVEL" Code

All your suggestions, requests and ideas for future development
Post Reply
p0wder2
Posts: 1
Joined: 12 Sep 2013, 22:51

[BUG] CLI Produces Same "ERRORLEVEL" Code

Post by p0wder2 »

Hello. I hadn't noticed this until now because I hadn't run into any failures since the update, but I use a custom written batch file for all my renaming processes and that batch file makes some extensive use of errorlevel checking in order notify me if there was a failure of any kind, as well as to get around matching problems by trying different databases. I ran into an issue today with some matching problems with Sons of Anarchy, yet I was not notified and the batch file simply ran through all processes normally. Once I finally figured out what was going on, I created a batch file to test the error codes and have included it below. The result has NOT been the case for all previous versions. Please fix this. Thank you for your time.

Below I have pasted the contents of the batch file and it's output (with filenames replaced with *****). The first process is ran on Sons of Anarchy, the second process is ran on The Colbert Report. The first process fails, the second succeeds, yet the errorlevel code is the same.

Batch File Contents:

@ECHO ON

filebot -rename -r -non-strict "D:\Temp\******" --output "D:\Temp\******-DB" --action copy --db TVRage --format "D:\Temp\******-DB\{n} - {airdate.format('yyyy.MM.dd')} - {t}/{n} - {airdate.format('yyyy.MM.dd')} - {t}" --conflict fail
SET RESULT=%errorlevel%
ECHO %RESULT%
PAUSE

filebot -rename -r -non-strict "D:\Temp\******" --output "D:\Temp\******-DB" --action copy --db TVRage --format "D:\Temp\******-DB\{n} - {airdate.format('yyyy.MM.dd')} - {t}/{n} - {airdate.format('yyyy.MM.dd')} - {t}" --conflict fail
SET RESULT=%errorlevel%
ECHO %RESULT%
PAUSE
EXIT
____________________________________________

Output of Batch Files:


D:\Temp>filebot -rename -r -non-strict "D:\Temp\******" --output "D:\Temp\******-DB" --action copy --db TVRage --format "D:\Temp\******-DB\{n} - {airdate.format('yyyy.MM.dd')} - {t}/{n} - {airdate.format('yyyy.MM.dd')} - {t}" --conflict fail
Rename episodes using [TVRage]
Auto-detected query: [Sons of Anarchy, of]
Fetching episode data for [Sons of Anarchy]
Exception: Unable to auto-select search result: [Legend of the Seeker, Body Of P
roof, Days of our Lives, The Suite Life of Zack and Cody, United States of Tara,
Sons of Guns, Band of Brothers, LEGO NinjaGo: Masters of Spinjitzu, Phil of the
Future, The Legend of Korra, 8 out of 10 Cats, Legion of Super Heroes, Dragons:
Riders of Berk, Rock of Love, Call of the Wildman, Flavor of Love, War of the W
orlds, The Legend of Tarzan, Top Of The Pops (UK), Marvel's Agents of S.H.I.E.L.
D.]
Failure (░_░)
Launch4j: Failed to run the given command.

The system cannot find the file specified.


D:\Temp>SET RESULT=0

D:\Temp>ECHO 0
0

D:\Temp>PAUSE
Press any key to continue . . .

D:\Temp>filebot -rename -r -non-strict "D:\Temp\******" --output "D:\Temp\******-DB" --action copy --db TVRage --format "D:\Temp\******-DB\{n} - {airdate.format('yyyy.MM.dd')} - {t}/{n} - {airdate.format('yyyy.MM.dd')} - {t}" --conflict fail
Rename episodes using [TVRage]
Auto-detected query: [The Colbert Report]
Fetching episode data for [The Colbert Report]
[COPY] Rename [D:\Temp\******\******] to [D:\Temp\******-DB\The Colbert Report - 2013.09.
11 - Sheryl Crow\The Colbert Report - 2013.09.11 - Sheryl Crow.mp4]
Processed 1 files
Done ?(?????)?

D:\Temp>SET RESULT=0

D:\Temp>ECHO 0
0

D:\Temp>PAUSE
Press any key to continue . . .
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [BUG] CLI Produces Same "ERRORLEVEL" Code

Post by rednoah »

l4j executable wrapper doesn't pass back the error code correctly. So on Windows not much I can do about it for now. Mac/Linux is not affected.

You could try using the portable package instead where I still have a cmd startup script which should preserve the exit code properly as with older versions of filebot.

The best solution would be a groovy script with that advanced processing. The exit code approach is very limited even if it works.
:idea: Please read the FAQ and How to Request Help.
Post Reply