fix(windows): resolve file locks and script execution issues #7
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
This PR fixes Windows compatibility issues related to file handling and script execution in the audit and update commands.
Changes
File Lock Fixes
deferto prevent file locks on Windows (cmd/audit.go)audit.Logger.Close()to nil the file pointer after closing (internal/audit/audit.go)defer logger.Close()calls in audit testsTest Fixes
cmd.exeon Windows (cmd/switch_test.go)#instead ofREM)chmodbehaves differently (cmd/audit_helpers_test.go)Update Command Fixes
.ps1on Windows,.shon Unix) for install scripts (cmd/update.go)Test Plan
Files Changed
cmd/audit.go- Add defer Close() callscmd/audit_helpers_test.go- Skip permission test on Windowscmd/audit_test.go- Add defer Close() callscmd/switch_test.go- Fix PowerShell executioncmd/update.go- Platform-specific temp file extensionscmd/update_test.go- Test temp file extensionsinternal/audit/audit.go- Improve Close() method