Skip to content

🔧 PowerShell 5.1でのgit stderrに対する耐性を向上#443

Open
tqer39 wants to merge 1 commit into
mainfrom
fix/install-ps1-native-command-error
Open

🔧 PowerShell 5.1でのgit stderrに対する耐性を向上#443
tqer39 wants to merge 1 commit into
mainfrom
fix/install-ps1-native-command-error

Conversation

@tqer39

@tqer39 tqer39 commented Jun 11, 2026

Copy link
Copy Markdown
Owner

📒 Summary of Changes

  • 🛠️ PowerShell 5.1でのgitのstderrメッセージを無視するように修正。
  • 🔄 エラープリファレンスをローカルで緩和し、実際の失敗を検出。

⚒ Technical Details

  • 📜 install.ps1内のUpdate-RepositoryおよびInstall-Repository関数で、$ErrorActionPreference"Continue"に設定。
  • 🔍 git diffおよびgit cloneの実行時に、エラーメッセージを無視し、$LASTEXITCODEで実際のエラーを確認。

⚠ Points of Caution

  • ⚠️ PowerShell 5.1の動作に依存しているため、他のバージョンでの動作確認が必要。

Summary by CodeRabbit

  • Bug Fixes
    • Resolved an issue affecting PowerShell 5.1 where repository installation and updates could fail due to improper error handling during git operations. Errors are now correctly detected and reported.

…rence

git emits informational messages (CRLF warnings, clone progress) on stderr.
Under $ErrorActionPreference = "Stop", PowerShell 5.1 wraps a native command's
stderr in NativeCommandError records and promotes them to terminating errors
even when the exit code is 0. Relax the preference locally in Update-Repository
and Install-Repository, and rely on $LASTEXITCODE to detect real failures.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f0f6d889-45c6-4b76-9894-2714b1c94512

📥 Commits

Reviewing files that changed from the base of the PR and between 85cdaf8 and 6cc671e.

📒 Files selected for processing (1)
  • install.ps1

📝 Walkthrough

Walkthrough

Install.ps1 modifies two git-related functions to prevent PowerShell 5.1 from treating native-command stderr as terminating errors. Update-Repository and Install-Repository now temporarily relax $ErrorActionPreference to "Continue" and detect failures via $LASTEXITCODE instead.

Changes

PowerShell Native Command Error Handling

Layer / File(s) Summary
Git operation error handling with relaxed preferences
install.ps1
Both Update-Repository (lines 191–197) and Install-Repository (lines 261–269) temporarily set $ErrorActionPreference = "Continue" around git commands to prevent stderr from triggering termination, and shift failure detection to explicit $LASTEXITCODE checks. Install-Repository also adds an explicit failure message and exit 1 on clone failure.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • tqer39/dotfiles#409: Both PRs modify install.ps1's PowerShell/native git stderr handling (disabling terminating behavior under $ErrorActionPreference="Stop" / $PSNativeCommandUseErrorActionPreference) so that git warnings don't abort install/update logic.

Suggested labels

claude-auto

Suggested reviewers

  • tqer39-apps

Poem

🐰 A script that feared each warning's cry,
Now handles errors with stderr's sigh—
Exit codes guide where warnings roam,
And git commands find their way home! 🚀

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title is in Japanese and uses an emoji, which violates clarity and accessibility principles for scanning commit history. Use English with clear technical language and remove emoji, e.g., 'Fix git stderr error handling in PowerShell 5.1' or similar.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/install-ps1-native-command-error

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot changed the title fix(install.ps1): tolerate git stderr under PowerShell 5.1 Stop preference 🔧 PowerShell 5.1でのgit stderrに対する耐性を向上 Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant