Skip to content

Commit bd3d23f

Browse files
author
panjunxun
committed
fix(multipath): Replace errors.Is with errors.As for error type checking
`errors.Is` can't handle `*exec.ExitError` correctly. Use `errors.As` to ensure capturing and handling non - zero exit code errors.
1 parent dd26709 commit bd3d23f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

iscsi/multipath.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func ExecWithTimeout(command string, args []string, timeout time.Duration) ([]by
3636

3737
if err != nil {
3838
var ee *exec.ExitError
39-
if ok := errors.Is(err, ee); ok {
39+
if ok := errors.As(err, &ee); ok {
4040
klog.V(2).Infof("Non-zero exit code: %s\n", err)
4141
err = fmt.Errorf("%s", ee.Stderr)
4242
}

0 commit comments

Comments
 (0)