Use invoke.CommandWithContext

This commit is contained in:
Punya Biswal 2021-09-28 10:05:33 -04:00
parent 5169bfe02d
commit 32b14a3723
2 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@ func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) {
if err != nil { if err != nil {
return nil, fmt.Errorf("could not find command %q: %w", swapCommand, err) 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 { if err != nil {
return nil, fmt.Errorf("could not execute %q: %w", swapCommand, err) return nil, fmt.Errorf("could not execute %q: %w", swapCommand, err)
} }

View File

@ -145,7 +145,7 @@ func SwapDevicesWithContext(ctx context.Context) ([]*SwapDevice, error) {
if err != nil { if err != nil {
return nil, fmt.Errorf("could not find command %q: %w", swapCommand, err) 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 { if err != nil {
return nil, fmt.Errorf("could not execute %q: %w", swapsCommand, err) return nil, fmt.Errorf("could not execute %q: %w", swapsCommand, err)
} }