From c8378e8b7dd66009ef3e36729875190c35fdc0df Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Wed, 22 Jun 2022 14:40:40 +0200 Subject: [PATCH 1/3] Quick fix to segfault on CLI when Headscale is not running (fix #652) --- cmd/headscale/cli/utils.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/headscale/cli/utils.go b/cmd/headscale/cli/utils.go index 327c8c14..50bd15f4 100644 --- a/cmd/headscale/cli/utils.go +++ b/cmd/headscale/cli/utils.go @@ -55,6 +55,7 @@ func getHeadscaleCLIClient() (context.Context, v1.HeadscaleServiceClient, *grpc. Err(err). Caller(). Msgf("Failed to load configuration") + os.Exit(-1) // we get here if logging is supressed (i.e., json output) } log.Debug(). @@ -116,6 +117,7 @@ func getHeadscaleCLIClient() (context.Context, v1.HeadscaleServiceClient, *grpc. conn, err := grpc.DialContext(ctx, address, grpcOptions...) if err != nil { log.Fatal().Caller().Err(err).Msgf("Could not connect: %v", err) + os.Exit(-1) // we get here if logging is supressed (i.e., json output) } client := v1.NewHeadscaleServiceClient(conn) From 72d1d2630e720c42470bd12af9ab8f82cb084c72 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Sun, 26 Jun 2022 09:52:04 +0200 Subject: [PATCH 2/3] Update cmd/headscale/cli/utils.go --- cmd/headscale/cli/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/headscale/cli/utils.go b/cmd/headscale/cli/utils.go index 50bd15f4..56da6be3 100644 --- a/cmd/headscale/cli/utils.go +++ b/cmd/headscale/cli/utils.go @@ -55,7 +55,7 @@ func getHeadscaleCLIClient() (context.Context, v1.HeadscaleServiceClient, *grpc. Err(err). Caller(). Msgf("Failed to load configuration") - os.Exit(-1) // we get here if logging is supressed (i.e., json output) + os.Exit(-1) // we get here if logging is suppressed (i.e., json output) } log.Debug(). From 34f489b1f43e6e25b269f4ad931285e76b7541b6 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Sun, 26 Jun 2022 09:52:11 +0200 Subject: [PATCH 3/3] Update cmd/headscale/cli/utils.go --- cmd/headscale/cli/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/headscale/cli/utils.go b/cmd/headscale/cli/utils.go index 56da6be3..c07e3a25 100644 --- a/cmd/headscale/cli/utils.go +++ b/cmd/headscale/cli/utils.go @@ -117,7 +117,7 @@ func getHeadscaleCLIClient() (context.Context, v1.HeadscaleServiceClient, *grpc. conn, err := grpc.DialContext(ctx, address, grpcOptions...) if err != nil { log.Fatal().Caller().Err(err).Msgf("Could not connect: %v", err) - os.Exit(-1) // we get here if logging is supressed (i.e., json output) + os.Exit(-1) // we get here if logging is suppressed (i.e., json output) } client := v1.NewHeadscaleServiceClient(conn)