diff --git a/mem/mem_bsd.go b/mem/mem_bsd.go index a82fddb..17ca920 100644 --- a/mem/mem_bsd.go +++ b/mem/mem_bsd.go @@ -28,7 +28,7 @@ func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) { if err != nil { return nil, fmt.Errorf("could not find command %q: %w", swapCommand, err) } - output, err := exec.Command(swapCommandPath, "-lk").Output() + output, err := invoke.CommandWithContext(swapCommandPath, "-lk") if err != nil { return nil, fmt.Errorf("could not execute %q: %w", swapCommand, err) } diff --git a/mem/mem_solaris.go b/mem/mem_solaris.go index 353d4cf..0c58314 100644 --- a/mem/mem_solaris.go +++ b/mem/mem_solaris.go @@ -145,7 +145,7 @@ func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) { if err != nil { return nil, fmt.Errorf("could not find command %q: %w", swapCommand, err) } - output, err := exec.Command(swapsCommandPath, "-l").Output() + output, err := invoke.CommandWithContext(swapsCommandPath, "-l") if err != nil { return nil, fmt.Errorf("could not execute %q: %w", swapsCommand, err) }