mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:30:53 +01:00
[PR #920] [MERGED] batch_glb: exit 2 for a bad input or output folder, 1 only for a failed model (BATCH-GLB-USAGE-EXIT-STATUS) #958
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#958
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/920
Author: @TuroYT
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD
Base:
main← Head:fix/batch-glb-usage-exit📝 Commits (2)
540e522batch_glb: exit 2 for a bad input or output folder (BATCH-GLB-USAGE-EXIT-STATUS)dda55b6batch_glb: wrap the exit status sentence in the module docstring📊 Changes
2 files changed (+27 additions, -3 deletions)
View changed files
📝
tests/test_batch_glb.py(+24 -1)📝
tools/batch_glb.py(+3 -2)📄 Description
Claimed in the coordination issue as: BATCH-GLB-USAGE-EXIT-STATUS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135524946)
What was wrong
tools/batch_glb.pydocuments "Exit status is 1 only when a model failed" (docstring, lines 8-9). Butmain()(line 265-267) catches(ValueError, OSError)frombatch_convertand returns 1. Those errors are input and output setup errors, not failed models:batch_convertraisesValueErrorfor a missing input folder.os.makedirsraisesOSErrorwhen the output path is a file or cannot be created.Reproduction on origin/main:
The input check in
batch_convertruns beforeos.makedirs, so the file-as-output case writes nothing.Why one
returnis enoughPer-model errors never reach that
except.convert_singlecatches everyExceptionand returns it as a failure, so a corrupt model or a bad texture is counted and returns 1 through the existing linereturn 0 if stats["failed"] == 0 else 1. I checked that no otherValueErrororOSErrorcan escape thetryfor a single model.What changed
main(): the setup-error branch returns 2 instead of 1.tests/test_batch_glb.py:test_cli_reports_directory_setup_errorsexpected 1 for both cases; it now expects 2. Newtest_cli_exit_status_follows_the_docstringpins the other exit codes: an empty input folder returns 0, a folder with one corrupt model returns 1, and an argparse usage error returns 2.No caller, script or doc in the repository depends on exit 1 for these errors (
git grep batch_glbfinds only the tool and its test).Tested
The new exit-status test passes on both versions by design: it pins the cases that were already correct, so a fix that over-corrects would fail it.
Edge cases run by hand on the fixed code:
Other checks:
Inputs are hand-made: a two-line OBJ and empty folders. No game files, no GPU.
Not tested
os.makedirserrors differ there). Only Linux was run.AI-assisted (Claude Code).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.