From 5e49b38c333a48d52e337ea21793e31851cb8fb8 Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Thu, 21 Feb 2019 21:20:20 -0300 Subject: [PATCH] Mitigate execext.Expand problems on Windows Closes #170 Co-authored-by: mikynov --- CHANGELOG.md | 4 +++- internal/execext/exec.go | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e07a645..c95a6136 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,9 @@ Mode is enabled ([#166](https://github.com/go-task/task/issues/166)); - Fix file timestamp issue when the file name has spaces - ([#176](https://github.com/go-task/task/issues/176)). + ([#176](https://github.com/go-task/task/issues/176)); +- Mitigating path expanding issues on Windows + ([#170](https://github.com/go-task/task/pull/170)). ## v2.3.0 - 2019-01-02 diff --git a/internal/execext/exec.go b/internal/execext/exec.go index 4d29cce8..e7bbe5d7 100644 --- a/internal/execext/exec.go +++ b/internal/execext/exec.go @@ -5,6 +5,7 @@ import ( "errors" "io" "os" + "path/filepath" "strings" "mvdan.cc/sh/expand" @@ -72,6 +73,7 @@ func IsExitError(err error) bool { // Expand is a helper to mvdan.cc/shell.Fields that returns the first field // if available. func Expand(s string) (string, error) { + s = filepath.ToSlash(s) s = strings.Replace(s, " ", `\ `, -1) fields, err := shell.Fields(s, nil) if err != nil {