From 246e04214a3554826be1f4285f56044b0850102d Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sun, 7 Dec 2025 02:08:05 +0900 Subject: [PATCH] internal/system: pass syscall error message This makes wrapped syscall errors produce a cleaner error message. Signed-off-by: Ophestra --- internal/system/output.go | 1 + internal/system/output_test.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/internal/system/output.go b/internal/system/output.go index a1666dc..80ab88e 100644 --- a/internal/system/output.go +++ b/internal/system/output.go @@ -26,6 +26,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(*os.SyscallError)), errors.As(e.Err, new(*net.OpError)), errors.As(e.Err, new(*container.StartError)): return e.Err.Error() diff --git a/internal/system/output_test.go b/internal/system/output_test.go index c0cbfdf..54d1225 100644 --- a/internal/system/output_test.go +++ b/internal/system/output_test.go @@ -44,6 +44,11 @@ func TestOpError(t *testing.T) { syscall.EISDIR, syscall.ENOTDIR, "cannot stat /run/dbus: is a directory"}, + {"syscall", newOpError("pipewire", os.NewSyscallError("pipe2", syscall.ENOTRECOVERABLE), false), + "pipe2: state not recoverable", + syscall.ENOTRECOVERABLE, syscall.ENOTDIR, + "cannot pipe2: state not recoverable"}, + {"net", newOpError("wayland", &net.OpError{Op: "dial", Net: "unix", Addr: &net.UnixAddr{Name: "/run/user/1000/wayland-1", Net: "unix"}, Err: syscall.ENOENT}, false), "dial unix /run/user/1000/wayland-1: no such file or directory", syscall.ENOENT, syscall.EPERM,