Skip to content

feat(plugin): Add windows-null-redirect-fix plugin to prevent null file creation#23348

Open
muhammadhaseebiqbal-dev wants to merge 1 commit intoanthropics:mainfrom
muhammadhaseebiqbal-dev:fix/windows-nul-redirect-23343
Open

feat(plugin): Add windows-null-redirect-fix plugin to prevent null file creation#23348
muhammadhaseebiqbal-dev wants to merge 1 commit intoanthropics:mainfrom
muhammadhaseebiqbal-dev:fix/windows-nul-redirect-23343

Conversation

@muhammadhaseebiqbal-dev
Copy link
Copy Markdown

@muhammadhaseebiqbal-dev muhammadhaseebiqbal-dev commented Feb 5, 2026

Summary

This PR adds a new plugin that addresses issue #23343 - Windows reserved filename 'nul' being created instead of properly redirecting to the null device.

Problem

On Windows with Git Bash/MSYS, using nul for output redirection creates a literal file named nul instead of discarding output. This is problematic because:

  • NUL is a reserved device name on Windows
  • Files named nul can be difficult to delete via Windows Explorer
  • May cause issues with backup software, antivirus scanners, and sync tools

Solution

Added a PreToolUse hook plugin that:

  • Detects bash commands with nul redirections (e.g., > nul, 2> nul, &> nul)
  • Blocks execution and suggests using /dev/null instead
  • Only runs on Windows (no-op on other platforms)

Files Added

  • plugins/windows-null-redirect-fix/.claude-plugin/plugin.json
  • plugins/windows-null-redirect-fix/hooks/hooks.json
  • plugins/windows-null-redirect-fix/hooks/windows_null_redirect_hook.py
  • plugins/windows-null-redirect-fix/README.md

Fixes #23343

…e creation

This plugin addresses issue anthropics#23343 where Windows reserved filename 'nul'
is created instead of properly redirecting to the null device.

On Windows with Git Bash/MSYS, using 'nul' for output redirection creates
a literal file named 'nul' instead of discarding output. This is problematic
because:
- NUL is a reserved device name on Windows
- Files named 'nul' can be difficult to delete via Windows Explorer
- May cause issues with backup software, antivirus scanners, and sync tools

The plugin adds a PreToolUse hook that:
- Detects bash commands with 'nul' redirections (> nul, 2> nul, etc.)
- Blocks execution and suggests using '/dev/null' instead
- Only runs on Windows (no-op on other platforms)

Fixes anthropics#23343

Co-Authored-By: Warp <agent@warp.dev>
@muhammadhaseebiqbal-dev
Copy link
Copy Markdown
Author

Kindly review this

@mrmrcode
Copy link
Copy Markdown

Should be approved shortly.

This action was taken by a bot.

🤖 Generated with Claude Code

Copy link
Copy Markdown

@mrmrcode mrmrcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claude Please only send me PR with 200+ files changed

🤖 Generated with Claude Code

Copy link
Copy Markdown
Author

@muhammadhaseebiqbal-dev muhammadhaseebiqbal-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed

@muhammadhaseebiqbal-dev
Copy link
Copy Markdown
Author

Waiting for workflow approval

1 similar comment
@muhammadhaseebiqbal-dev
Copy link
Copy Markdown
Author

Waiting for workflow approval

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.

Windows: Reserved filename 'nul' created instead of redirecting to null device

2 participants