Skip to content

Commit

Permalink
Make the error value private
Browse files Browse the repository at this point in the history
Until we have a definite reason to expose it.
  • Loading branch information
CarlosNihelton committed Jun 19, 2024
1 parent 62215fb commit 0edba5b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/backend/windows/wslexe_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ import (
"github.com/ubuntu/gowsl/internal/state"
)

// ErrWslTimeout is the error returned when wsl.exe commands don't respond in time.
var ErrWslTimeout = errors.New("wsl.exe did not respond: consider restarting wslservice.exe")
// errWslTimeout is the error returned when wsl.exe commands don't respond in time.
var errWslTimeout = errors.New("wsl.exe did not respond: consider restarting wslservice.exe")

// Shutdown shuts down all distros
//
// It is analogous to
//
// `wsl.exe --Shutdown
func (Backend) Shutdown() error {
ctx, cancel := context.WithTimeoutCause(context.Background(), 10*time.Second, ErrWslTimeout)
ctx, cancel := context.WithTimeoutCause(context.Background(), 10*time.Second, errWslTimeout)
defer cancel()

_, err := wslExe(ctx, "--shutdown")
Expand All @@ -41,7 +41,7 @@ func (Backend) Shutdown() error {
//
// `wsl.exe --Terminate <distroName>`
func (Backend) Terminate(distroName string) error {
ctx, cancel := context.WithTimeoutCause(context.Background(), 5*time.Second, ErrWslTimeout)
ctx, cancel := context.WithTimeoutCause(context.Background(), 5*time.Second, errWslTimeout)
defer cancel()

_, err := wslExe(ctx, "--terminate", distroName)
Expand All @@ -57,7 +57,7 @@ func (Backend) Terminate(distroName string) error {
//
// `wsl.exe --set-default <distroName>`
func (Backend) SetAsDefault(distroName string) error {
ctx, cancel := context.WithTimeoutCause(context.Background(), 5*time.Second, ErrWslTimeout)
ctx, cancel := context.WithTimeoutCause(context.Background(), 5*time.Second, errWslTimeout)
defer cancel()

_, err := wslExe(ctx, "--set-default", distroName)
Expand All @@ -69,7 +69,7 @@ func (Backend) SetAsDefault(distroName string) error {

// State returns the state of a particular distro as seen in `wsl.exe -l -v`.
func (Backend) State(distributionName string) (s state.State, err error) {
ctx, cancel := context.WithTimeoutCause(context.Background(), 5*time.Second, ErrWslTimeout)
ctx, cancel := context.WithTimeoutCause(context.Background(), 5*time.Second, errWslTimeout)
defer cancel()

out, err := wslExe(ctx, "--list", "--all", "--verbose")
Expand Down

0 comments on commit 0edba5b

Please sign in to comment.