fix: address final-review findings before closing Plan 1
- privilege: wire sudo -v to real stdin/stdout/stderr so it can prompt - cmd: validate --only/--skip IDs against registry (prevents silent run-all on typo); gate install to Arch-only (spec requirement); mark --only and --skip mutually exclusive - platform: Pacman.Update now runs -Syu --noconfirm, not -Sy (avoids Arch partial-upgrade anti-pattern) - test/integration: trap-clean the named docker volume on any exit - go.mod: tidy — yaml.v3 is a direct dep
This commit is contained in:
@@ -5,6 +5,7 @@ package privilege
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"time"
|
||||
)
|
||||
@@ -36,7 +37,11 @@ type ExecSudo struct{}
|
||||
|
||||
func (ExecSudo) Validate(ctx context.Context) error {
|
||||
cmd := exec.CommandContext(ctx, "sudo", "-v")
|
||||
cmd.Stdin = nil // inherit terminal stdin
|
||||
// Connect to the real terminal so sudo can prompt for the password.
|
||||
// exec.Cmd.Stdin defaults to /dev/null, not the parent process's stdin.
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
return cmd.Run()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user