diff --git a/CHANGELOG.md b/CHANGELOG.md index 82669209..db951a69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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` diff --git a/internal/compiler/v3/compiler_v3.go b/internal/compiler/v3/compiler_v3.go index 4ccce500..0d129b51 100644 --- a/internal/compiler/v3/compiler_v3.go +++ b/internal/compiler/v3/compiler_v3.go @@ -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)