1
0
mirror of https://github.com/go-task/task.git synced 2025-01-22 05:10:17 +02:00

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

@ -1,5 +1,11 @@
# Changelog
## Unreleased
- Fixed bug where, on Windows, variables were ending with `\r` because we were
only removing the final `\n` but not `\r\n`
([#717](https://github.com/go-task/task/issues/717)).
## v3.12.0 - 2022-03-31
- The `--list` and `--list-all` flags can now be combined with the `--silent`

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)