Skip to content

Commit 9b5ceb5

Browse files
committed
cli/command/container: exit 126 on EISDIR error
The error returned from "os/exec".Command when attempting to execute a directory has been changed from syscall.EACCESS to syscall.EISDIR on Go 1.20. golang/go@2b8f214 Consequently, any runc runtime built against Go 1.20 will return an error containing 'is a directory' and not 'permission denied'. Update the string matching so the CLI exits with status code 126 on 'is a directory' errors (EISDIR) in addition to 'permission denied' (EACCESS). Signed-off-by: Cory Snider <csnider@mirantis.com>
1 parent e92dd87 commit 9b5ceb5

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

cli/command/container/run.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,8 @@ func runStartContainerErr(err error) error {
308308
strings.Contains(trimmedErr, "no such file or directory") ||
309309
strings.Contains(trimmedErr, "system cannot find the file specified") {
310310
statusError = cli.StatusError{StatusCode: 127}
311-
} else if strings.Contains(trimmedErr, syscall.EACCES.Error()) {
311+
} else if strings.Contains(trimmedErr, syscall.EACCES.Error()) ||
312+
strings.Contains(trimmedErr, syscall.EISDIR.Error()) {
312313
statusError = cli.StatusError{StatusCode: 126}
313314
}
314315

0 commit comments

Comments
 (0)