feat(plugins): add windows-nul-fix plugin to auto-remove problematic nul files#13949
Open
kp222x wants to merge 1 commit intoanthropics:mainfrom
Open
feat(plugins): add windows-nul-fix plugin to auto-remove problematic nul files#13949kp222x wants to merge 1 commit intoanthropics:mainfrom
kp222x wants to merge 1 commit intoanthropics:mainfrom
Conversation
…nul files On Windows, when Claude Code runs bash commands using Git Bash, it sometimes uses '2>nul' for stderr redirection (Windows CMD syntax). In Unix shells, this creates a literal file named 'nul' instead of redirecting to the null device, causing several issues: - Cannot be easily deleted via Windows Explorer or PowerShell - Breaks git add/commit operations - Can corrupt source control history - Appears repeatedly after each bash command This plugin adds a PostToolUse hook that automatically removes any 'nul' files from the current working directory after Bash tool execution. Features: - Only activates on Windows (os.platform() === "win32") - Runs silently after every Bash tool execution - Does not interrupt workflow on errors - Minimal overhead (5s timeout) Fixes anthropics#4928
76688ef to
b654c00
Compare
|
I can confirm this is an annoying issue on Win, and it's not just Git that doesn't like these files I've added this to my CLAUDE.md, but it's not 100% reliable |
|
Please also implement fixes for other issues on windows listed here: #5049 |
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.
Summary
Adds a new plugin that automatically removes the problematic
nulfiles created by Claude Code on Windows.This is a workaround for the long-standing issue where Claude Code uses
2>nul(Windows CMD syntax) when running in Git Bash or other Unix-like shells on Windows, creating a literal file namednulinstead of redirecting to the null device.The Problem
Impact: 60+ users affected over 4+ months (see issue comments)
When Claude runs bash commands on Windows:
2>nulfor stderr redirection (CMD syntax)nulas a regular filenamegit addandgit commitoperationsThe Solution
This plugin adds a
PostToolUsehook that:os.platform() === "win32")nulfile in the current working directoryPlugin Structure
Test Plan
Test Evidence
Installation (for users)
Once merged, users can install via:
Or manually copy to
~/.claude/plugins/Related
🤖 Generated with Claude Code