From 130c5e727bebf677d80a64c93631085c679903da Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Tue, 20 Jul 2021 12:18:40 -0700 Subject: [PATCH] safesocket: reduce log spam while running integration tests Instead of logging lsof execution failures to stdout, incorporate them into the returned error. While we're here, make it clear that the file success case always returns a nil error. Signed-off-by: Josh Bleecher Snyder --- safesocket/unixsocket.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/safesocket/unixsocket.go b/safesocket/unixsocket.go index 303b9c27d..14d62e3d1 100644 --- a/safesocket/unixsocket.go +++ b/safesocket/unixsocket.go @@ -28,16 +28,15 @@ func connect(path string, port uint16) (net.Conn, error) { pipe, err := net.Dial("unix", path) if err != nil { if runtime.GOOS == "darwin" { - extConn, err := connectMacOSAppSandbox() - if err != nil { - log.Printf("safesocket: failed to connect to Tailscale IPNExtension: %v", err) - } else { - return extConn, nil + extConn, extErr := connectMacOSAppSandbox() + if extErr != nil { + return nil, fmt.Errorf("safesocket: failed to connect to %v: %v; failed to connect to Tailscale IPNExtension: %v", path, err, extErr) } + return extConn, nil } return nil, err } - return pipe, err + return pipe, nil } // TODO(apenwarr): handle magic cookie auth