mirror of
https://github.com/shirou/gopsutil.git
synced 2025-04-29 13:49:21 +08:00
Use invoke.CommandWithContext
This commit is contained in:
parent
5169bfe02d
commit
32b14a3723
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user