Closed Butterfly-Dragon closed 2 years ago
It's using sys.exit()
, so gallery-dl has exit codes that get returned to stderr, e.g.
But not for every possible use case, I think, and they are not really documented yet. Still usable, tho
D:\Temp>%ERRORLEVEL%
'0' is not recognized as an internal or external command,
operable program or batch file.
D:\Temp>gallery-dl
usage: gallery-dl [OPTION]... URL...
gallery-dl: error: The following arguments are required: URL
Use 'gallery-dl --help' to get a list of all options.
D:\Temp>IF %ERRORLEVEL% EQU 2 ECHO "BINGO"
"BINGO"
D:\Temp>
In Powershell you can use the built-ins $LASTEXITCODE and $?, e.g.
PS D:\Temp> gallery-dl --version
1.20.2-dev
PS D:\Temp> $?
True
PS D:\Temp> gallery-dl
usage: gallery-dl [OPTION]... URL...
gallery-dl: error: The following arguments are required: URL
Use 'gallery-dl --help' to get a list of all options.
PS D:\Temp> $?
False
PS D:\Temp>
I'm usually using exit code handling for my own scripts, but I'm actually not with gallery-dl, because it already has a good logging functionality which handles that use case for me, basically.
Uh... no i meant that i wanted to know if i get an errorlevel of 73 (example)... what does that mean? because thrawling through 4 megabytes of log each time is kinda boring.
I think there are only a couple of exit codes.. and they don't tell you anything you couldn't gather from the logs. Why are your logs so huge? Are you logging every debug message that does not even indicate any issue?
no, i have several in a batch jobs that go on forever. aside from 3 or 4 that exit after 3 entries... the rest have something like 1000 entries at the shortest, and so i reduced the abort to 3 and try and keep it that way, i am trying to find ways to cut time.
Exit codes are, like many other things, nowhere "officially" documented, but you can find a list in issue #1120.
thank you very much.
in my batch files i tend to put a "translation" of the exit codes.
Example: this is the translation of the exit codes for
ROBOCOPY
i'm probably reading it wrong but i don't find a list of exit codes for
gallery_dl
.Is it because they are mostly for your personal use and therefore you never bothered?
Or is it because i totally flew over where they are listed?