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 <josh@tailscale.com>
This commit is contained in:
Josh Bleecher Snyder 2021-07-20 12:18:40 -07:00 committed by Josh Bleecher Snyder
parent f80193fa4c
commit 130c5e727b

View File

@ -28,16 +28,15 @@ func connect(path string, port uint16) (net.Conn, error) {
pipe, err := net.Dial("unix", path) pipe, err := net.Dial("unix", path)
if err != nil { if err != nil {
if runtime.GOOS == "darwin" { if runtime.GOOS == "darwin" {
extConn, err := connectMacOSAppSandbox() extConn, extErr := connectMacOSAppSandbox()
if err != nil { if extErr != nil {
log.Printf("safesocket: failed to connect to Tailscale IPNExtension: %v", err) return nil, fmt.Errorf("safesocket: failed to connect to %v: %v; failed to connect to Tailscale IPNExtension: %v", path, err, extErr)
} else {
return extConn, nil
} }
return extConn, nil
} }
return nil, err return nil, err
} }
return pipe, err return pipe, nil
} }
// TODO(apenwarr): handle magic cookie auth // TODO(apenwarr): handle magic cookie auth