From b4252cc5bec0cdbfb138ff6ef986bed981d45034 Mon Sep 17 00:00:00 2001 From: Jan Dubois Date: Thu, 7 Nov 2024 21:27:56 -0800 Subject: [PATCH] Use printf instead of $'' to pass a multi-line string to bash The script will be executed by the default shell of the ssh user, and `fish` does not support the $'' syntax. Signed-off-by: Jan Dubois --- pkg/hostagent/requirements.go | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/pkg/hostagent/requirements.go b/pkg/hostagent/requirements.go index 2f290768499..009086556d4 100644 --- a/pkg/hostagent/requirements.go +++ b/pkg/hostagent/requirements.go @@ -3,6 +3,7 @@ package hostagent import ( "errors" "fmt" + "strings" "time" "github.com/lima-vm/lima/pkg/limayaml" @@ -61,14 +62,17 @@ func (a *HostAgent) waitForRequirements(label string, requirements []requirement // EOF // /usr/bin/env ruby // -// ssh.ExecuteScript will strip the `#!` prefix from the first line and invoke the rest -// of the line as the command. The full script is then passed via STDIN. We use the $' ' -// form of shell quoting to be able to use \n as newline escapes to fit everything on a +// ssh.ExecuteScript will strip the `#!` prefix from the first line and invoke the +// rest of the line as the command. The full script is then passed via STDIN. We use +// "$(printf '…')" to be able to use \n as newline escapes, to fit everything on a // single line: // -// #!/bin/bash -c $'while … done<