aboutsummaryrefslogtreecommitdiffhomepage
path: root/system
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-09-06 17:41:06 +0900
committerOphestra <cat@gensokyo.uk>2025-09-06 17:41:06 +0900
commitfcd0f2ede7e51b92ffbc91e57f6096e29b3b5b7d (patch)
tree8a9913a30045ccc4f7d950f101145442ae3f3c73 /system
parente68db7fbfc367f25ccbaf57ec43f0f4b3c93cba7 (diff)
system/output: pass through LinkError
This has similar formatting to PathError. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'system')
-rw-r--r--system/output.go1
-rw-r--r--system/output_test.go20
2 files changed, 7 insertions, 14 deletions
diff --git a/system/output.go b/system/output.go
index e602976c..f183ebfe 100644
--- a/system/output.go
+++ b/system/output.go
@@ -34,6 +34,7 @@ func (e *OpError) Error() string {
switch {
case errors.As(e.Err, new(*os.PathError)),
+ errors.As(e.Err, new(*os.LinkError)),
errors.As(e.Err, new(*net.OpError)),
errors.As(e.Err, new(*container.StartError)):
return e.Err.Error()
diff --git a/system/output_test.go b/system/output_test.go
index 2dfa337d..b091f5ef 100644
--- a/system/output_test.go
+++ b/system/output_test.go
@@ -137,22 +137,14 @@ func TestPrintJoinedError(t *testing.T) {
{"file descriptor in bad state"},
}},
{"many message", errors.Join(
- &container.StartError{
- Step: "meow",
- Err: syscall.ENOMEM,
- },
- &os.PathError{
- Op: "meow",
- Path: "/proc/nonexistent",
- Err: syscall.ENOSYS,
- },
- &OpError{
- Op: "meow",
- Err: syscall.ENODEV,
- Revert: true,
- }), [][]any{
+ &container.StartError{Step: "meow", Err: syscall.ENOMEM},
+ &os.PathError{Op: "meow", Path: "/proc/nonexistent", Err: syscall.ENOSYS},
+ &os.LinkError{Op: "link", Old: "/etc", New: "/proc/nonexistent", Err: syscall.ENOENT},
+ &OpError{Op: "meow", Err: syscall.ENODEV, Revert: true},
+ ), [][]any{
{"cannot meow: cannot allocate memory"},
{"meow /proc/nonexistent: function not implemented"},
+ {"link /etc /proc/nonexistent: no such file or directory"},
{"cannot revert meow: no such device"},
}},
}