fix: Discard git ls-files output#11
Merged
StackInTheWild merged 1 commit intoStackInTheWild:mainfrom Oct 6, 2025
Merged
Conversation
…e named nul instead of being discarded.
StackInTheWild
approved these changes
Oct 6, 2025
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where the git ls-files command was incorrectly redirecting stderr to a file named "nul" instead of properly discarding the output. The fix changes the redirection from 2>nul to 2>/dev/null to properly suppress error messages.
- Changed stderr redirection from creating a "nul" file to discarding output via
/dev/null
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| local files = {} | ||
|
|
||
| local handle = io.popen("git ls-files 2>nul") | ||
| local handle = io.popen("git ls-files 2>/dev/null") |
There was a problem hiding this comment.
The fix uses /dev/null which is Unix-specific and won't work on Windows. Consider using a cross-platform solution like 2>nul on Windows and 2>/dev/null on Unix, or check if the git command supports --quiet flag to suppress errors.
Suggested change
| local handle = io.popen("git ls-files 2>/dev/null") | |
| local dir_sep = package.config:sub(1,1) | |
| local null_redir = (dir_sep == '\\') and "2>nul" or "2>/dev/null" | |
| local handle = io.popen("git ls-files " .. null_redir) |
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.
Current version creates a file named
nulin my current working directory. I think the intention is to discard this output instead.