Conversation
added 6 commits
February 18, 2026 13:37
- Fix 'write /dev/stdout: The handle is invalid' error on Windows by not writing to os.Stdout/Stderr directly - Add --verbose flag to butler apply command for better output - Add comprehensive debug logging that writes to butler-debug.log on failure - Add TestButler() diagnostic function to help troubleshoot butler issues - Log environment variables and butler version before running commands
When users modify game files (add/remove files), butler's signature verification fails with 'expected X dirs, got Y dirs' error. This fix: - Detects signature verification failures by checking stderr output - Automatically cleans the game directory when signature mismatch is detected - Retries the patch application with a fresh directory - Provides clear error messages if cleanup or retry fails This prevents users from being stuck with a broken installation that requires manual intervention.
The signature verification error message appears in different places depending on butler version. Now checks both stdout and stderr for signature errors.
Butler keeps resume state in the staging directory. When we clean the game directory, we also need to clean the staging directory to prevent butler from trying to resume from a corrupted state.
…handling - Remove verbose logging of every file in game directory - Remove butler version check on every patch (not needed) - Remove environment variable logging - Simplify debug log format to essential info only - Keep signature error detection and auto-retry logic - Keep debug log writing for troubleshooting failures
- Extract handleApplyError for error handling logic - Extract isSignatureError for signature detection - Extract retryAfterCleanup for retry logic - Extract cleanup for resource cleanup - Extract writeDebugLog for debug file creation - Remove redundant error logging (errors are returned and logged upstream) - Simplify DownloadAndApplyPWR by removing verbose logging
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixed butler applying related bugs
Cause of bugs was that user might create/delete/edit game files that caused butler signature checking fail. Before applying game update we apply signature, if it passes we just upgrade existing files, if not then reinstall game completely