From 49280286ad225a9c97be3beee4d05072b1c11d65 Mon Sep 17 00:00:00 2001 From: sophia Date: Wed, 14 Sep 2022 15:12:32 -0400 Subject: [PATCH] Strip new lines from error details The error details message should just be one string without spacing so the terminal can set a output length. This will allow messages from Ruby and Go errors to have similar formating. --- internal/core/vagrantfile.go | 1 + plugins/commands/serve/util/exception_transformer.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/core/vagrantfile.go b/internal/core/vagrantfile.go index 67237cda1..fd786155c 100644 --- a/internal/core/vagrantfile.go +++ b/internal/core/vagrantfile.go @@ -525,6 +525,7 @@ func (v *Vagrantfile) TargetConfig( "provider_not_usable", map[string]string{"Provider": provider, "Machine": name}, errStatus, + true, ) } } diff --git a/plugins/commands/serve/util/exception_transformer.rb b/plugins/commands/serve/util/exception_transformer.rb index dc12343b7..bf5c61239 100644 --- a/plugins/commands/serve/util/exception_transformer.rb +++ b/plugins/commands/serve/util/exception_transformer.rb @@ -58,7 +58,7 @@ module VagrantPlugins if err.is_a? Vagrant::Errors::VagrantError localized_msg_details_any = Google::Protobuf::Any.new localized_msg_details_any.pack( - Google::Rpc::LocalizedMessage.new(locale: "en-US", message: message) + Google::Rpc::LocalizedMessage.new(locale: "en-US", message: message.gsub("\n", " ")) ) proto = Google::Rpc::Status.new( code: GRPC::Core::StatusCodes::UNKNOWN,