Wiki sync: stop treating git's stderr as fatal#5
Merged
Conversation
PowerShell with ErrorActionPreference=Stop escalates ANY native-command stderr output to a script-terminating error. git writes plenty of informational lines to stderr (CRLF nags, "remote: Processed N references", "Switched to branch X"), which made the sync script abort partway through every run when actually nothing was wrong. Three fixes: 1. Switch to ErrorActionPreference=Continue and check $LASTEXITCODE manually after each git call. 2. Drain stderr on each git invocation with `2>&1 | Out-Null`. 3. Disable core.autocrlf and core.safecrlf in the throwaway wiki clone so git stops complaining about line endings. Verified end-to-end against Gitea: 12 pages + sidebar pushed cleanly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Wiki sync: stop treating git's stderr warnings as fatal
PowerShell with
$ErrorActionPreference = 'Stop'escalates ANY native-command stderr output to a script-terminating error. git writes plenty of informational lines to stderr (CRLF nags,remote: Processed N references,Switched to branch X), which made the sync script abort partway through every run when nothing was actually wrong.Three fixes:
ErrorActionPreference = 'Continue'and check$LASTEXITCODEafter each git call.2>&1 | Out-Null.core.autocrlfandcore.safecrlfin the throwaway wiki clone so git stops complaining about line endings.Verified end-to-end: Gitea wiki now has 12 pages + sidebar pushed cleanly.
Generated with Claude Code