From dc03dce1c9036efb55ec764223b894dc9d64c51e Mon Sep 17 00:00:00 2001 From: Joe Lim <50560759+joelim-work@users.noreply.github.com> Date: Sat, 5 Aug 2023 22:11:54 +1000 Subject: [PATCH] Wrap filenames in quotes only for Windows CMD --- os_windows.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/os_windows.go b/os_windows.go index 47968868..9e579c8e 100644 --- a/os_windows.go +++ b/os_windows.go @@ -180,5 +180,9 @@ func errCrossDevice(err error) bool { } func quoteString(s string) string { - return fmt.Sprintf(`"%s"`, s) + // Windows CMD requires special handling to deal with quoted arguments + if strings.ToLower(gOpts.shell) == "cmd" { + return fmt.Sprintf(`"%s"`, s) + } + return s }