From 334a8dfc3ce153f33464ffe77fceddd5d4bdf02d Mon Sep 17 00:00:00 2001 From: Jan Dubois Date: Thu, 7 Nov 2024 21:22:29 -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 | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/pkg/hostagent/requirements.go b/pkg/hostagent/requirements.go index 2f290768499a..d54d8cbcc3f2 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<