cmd/tailscale: make ping --until-direct require direct connection to exit 0

If --until-direct is set, the goal is to make a direct connection.
If we failed at that, say so, and exit with an error.

RELNOTE=tailscale ping --until-direct (the default) now exits with
a non-zero exit code if no direct connection was established.

Signed-off-by: Josh Bleecher Snyder <[email protected]>
This commit is contained in:
Josh Bleecher Snyder authored and Josh Bleecher Snyder committed 2021-05-13 15:07:19 -07:00
1 parent 6fd4e8d244
commit 6f62bbae79
1 file changed
+3
+3
View File
@@ -139,6 +139,9 @@ func runPing(ctx context.Context, args []string) error {
if !anyPong {
return errors.New("no reply")
}
if pingArgs.untilDirect {
return errors.New("direct connection not established")
}
return nil
}
}