mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-18 02:48:40 +00:00
safesocket: print full lsof command on failure
This makes it easier to manually run the command to discover why it is failing. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
parent
130c5e727b
commit
24db1a3c9b
@ -53,15 +53,16 @@ func localTCPPortAndTokenDarwin() (port int, token string, err error) {
|
|||||||
// The current process is running outside the sandbox, so use
|
// The current process is running outside the sandbox, so use
|
||||||
// lsof to find the IPNExtension:
|
// lsof to find the IPNExtension:
|
||||||
|
|
||||||
out, err := exec.Command("lsof",
|
cmd := exec.Command("lsof",
|
||||||
"-n", // numeric sockets; don't do DNS lookups, etc
|
"-n", // numeric sockets; don't do DNS lookups, etc
|
||||||
"-a", // logical AND remaining options
|
"-a", // logical AND remaining options
|
||||||
fmt.Sprintf("-u%d", os.Getuid()), // process of same user only
|
fmt.Sprintf("-u%d", os.Getuid()), // process of same user only
|
||||||
"-c", "IPNExtension", // starting with IPNExtension
|
"-c", "IPNExtension", // starting with IPNExtension
|
||||||
"-F", // machine-readable output
|
"-F", // machine-readable output
|
||||||
).Output()
|
)
|
||||||
|
out, err := cmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, "", fmt.Errorf("failed to run lsof looking for IPNExtension: %w", err)
|
return 0, "", fmt.Errorf("failed to run '%s' looking for IPNExtension: %w", cmd, err)
|
||||||
}
|
}
|
||||||
bs := bufio.NewScanner(bytes.NewReader(out))
|
bs := bufio.NewScanner(bytes.NewReader(out))
|
||||||
subStr := []byte(".tailscale.ipn.macos/sameuserproof-")
|
subStr := []byte(".tailscale.ipn.macos/sameuserproof-")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user