runc exec: fail with exit code of 255

Currently there's no way to distinguish between the two cases:
 - runc exec failed;
 - the command executed returned 1.

This was possible before commit 8477638aab, as runc exec exited with
the code of 255 if exec itself has failed. The code of 255 is the same
convention as used by e.g. ssh.

Re-introduce the feature, document it, and add some tests so it won't be
broken again.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2021-07-07 18:08:52 -07:00
parent 1f5f237b37
commit 60e02b4b25
4 changed files with 33 additions and 3 deletions
+2 -1
View File
@@ -101,7 +101,8 @@ following will output a list of processes running in the container:
if err == nil {
os.Exit(status)
}
return fmt.Errorf("exec failed: %w", err)
fatalWithCode(fmt.Errorf("exec failed: %w", err), 255)
return nil // to satisfy the linter
},
SkipArgReorder: true,
}