From 2c63b8439bbdc09203ea394ad2cf9352830861f0 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Sat, 10 Sep 2022 07:40:39 -0400 Subject: Fix stutters Podman adds an Error: to every error message. So starting an error message with "error" ends up being reported to the user as Error: error ... This patch removes the stutter. Also ioutil.ReadFile errors report the Path, so wrapping the err message with the path causes a stutter. Signed-off-by: Daniel J Walsh --- pkg/machine/wsl/machine.go | 2 +- pkg/machine/wsl/util_windows.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'pkg/machine/wsl') diff --git a/pkg/machine/wsl/machine.go b/pkg/machine/wsl/machine.go index 7e453823f..44b82b823 100644 --- a/pkg/machine/wsl/machine.go +++ b/pkg/machine/wsl/machine.go @@ -939,7 +939,7 @@ func (v *MachineVM) Set(_ string, opts machine.SetOptions) ([]error, error) { if opts.Rootful != nil && v.Rootful != *opts.Rootful { err := v.setRootful(*opts.Rootful) if err != nil { - setErrors = append(setErrors, fmt.Errorf("error setting rootful option: %w", err)) + setErrors = append(setErrors, fmt.Errorf("setting rootful option: %w", err)) } else { v.Rootful = *opts.Rootful } diff --git a/pkg/machine/wsl/util_windows.go b/pkg/machine/wsl/util_windows.go index 6613bde1f..67d1bfc5c 100644 --- a/pkg/machine/wsl/util_windows.go +++ b/pkg/machine/wsl/util_windows.go @@ -263,19 +263,19 @@ func obtainShutdownPrivilege() error { var hToken uintptr if ret, _, err := OpenProcessToken.Call(uintptr(proc), TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, uintptr(unsafe.Pointer(&hToken))); ret != 1 { - return fmt.Errorf("error opening process token: %w", err) + return fmt.Errorf("opening process token: %w", err) } var privs TokenPrivileges if ret, _, err := LookupPrivilegeValue.Call(uintptr(0), uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(SeShutdownName))), uintptr(unsafe.Pointer(&(privs.privileges[0].luid)))); ret != 1 { - return fmt.Errorf("error looking up shutdown privilege: %w", err) + return fmt.Errorf("looking up shutdown privilege: %w", err) } privs.privilegeCount = 1 privs.privileges[0].attributes = SE_PRIVILEGE_ENABLED if ret, _, err := AdjustTokenPrivileges.Call(hToken, 0, uintptr(unsafe.Pointer(&privs)), 0, uintptr(0), 0); ret != 1 { - return fmt.Errorf("error enabling shutdown privilege on token: %w", err) + return fmt.Errorf("enabling shutdown privilege on token: %w", err) } return nil -- cgit v1.2.3-54-g00ecf