Replace \r\n on Windows as we do for \n on Linux

Closes #717
This commit is contained in:
Andrey Nering
2022-05-08 17:33:54 -03:00
parent 4951a2bf7a
commit 1acd59c7d6
2 changed files with 8 additions and 1 deletions

View File

@@ -151,7 +151,8 @@ func (c *CompilerV3) HandleDynamicVar(v taskfile.Var, dir string) (string, error
// Trim a single trailing newline from the result to make most command
// output easier to use in shell commands.
result := strings.TrimSuffix(stdout.String(), "\n")
result := strings.TrimSuffix(stdout.String(), "\r\n")
result = strings.TrimSuffix(result, "\n")
c.dynamicCache[v.Sh] = result
c.Logger.VerboseErrf(logger.Magenta, `task: dynamic variable: '%s' result: '%s'`, v.Sh, result)