diff --git a/src/commands/firewall/trust_after_windows.go b/src/commands/firewall/trust_after_windows.go index bfafda8..695e8c5 100644 --- a/src/commands/firewall/trust_after_windows.go +++ b/src/commands/firewall/trust_after_windows.go @@ -81,5 +81,15 @@ func findModuleLaunchers(name string) []string { add(filepath.Join(appdata, "npm", name+".cmd")) add(filepath.Join(appdata, "npm", name+".bat")) } + + // Standalone pnpm (get.pnpm.io): PNPM_HOME\bin\pnpm.cmd + if strings.EqualFold(name, "pnpm") { + if home := strings.TrimSpace(os.Getenv("PNPM_HOME")); home != "" { + add(filepath.Join(home, "bin", name+".cmd")) + add(filepath.Join(home, "bin", name+".bat")) + add(filepath.Join(home, name+".cmd")) + add(filepath.Join(home, name+".bat")) + } + } return out } diff --git a/src/commands/sync.go b/src/commands/sync.go index 36f7c01..a5ab5b1 100644 --- a/src/commands/sync.go +++ b/src/commands/sync.go @@ -118,7 +118,11 @@ func (c *Doctor) Run() error { return cmd.Run() } -type Reshim struct{} +type Reshim struct { + // Force is accepted for compatibility with reshim.exe / hint text ("nvm reshim --force"). + // sync.exe reshim always passes --force to reshim.exe, so this flag is a no-op. + Force bool `flag:"force" help:"Force recreation of locked shims (always applied by sync)."` +} func (c *Reshim) Run() error { sync, err := getSyncToolPath() diff --git a/src/test/commands/cli_t5_test.go b/src/test/commands/cli_t5_test.go index c8ed918..7ba0cf2 100644 --- a/src/test/commands/cli_t5_test.go +++ b/src/test/commands/cli_t5_test.go @@ -19,6 +19,18 @@ func TestCLIReshimCommand(t *testing.T) { } } +func TestCLIReshimForceFlagAccepted(t *testing.T) { + sb := clitest.NewSandbox(t) + + stdout, stderr, err := sb.ExecuteWithSyncStub("reshim", "--force") + if err != nil { + t.Fatalf("Execute(reshim --force) error = %v stderr = %q stdout = %q", err, stderr, stdout) + } + if strings.Contains(stderr, "unknown flag") { + t.Fatalf("Execute(reshim --force) stderr = %q, flag should be accepted", stderr) + } +} + func TestCLIDoctorCommand(t *testing.T) { sb := clitest.NewSandbox(t)