Skip to content

Commit 96ce5ed

Browse files
committed
Only print interp error if using CoreUtils.
1 parent 6eed751 commit 96ce5ed

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

internal/execext/coreutils.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ import (
77
"github.com/go-task/task/v3/internal/env"
88
)
99

10-
var useGoCoreUtils bool
10+
var UseGoCoreUtils bool
1111

1212
func init() {
1313
// If TASK_CORE_UTILS is set to either true or false, respect that.
1414
// By default, enable on Windows only.
1515
if v, err := strconv.ParseBool(env.GetTaskEnv("CORE_UTILS")); err == nil {
16-
useGoCoreUtils = v
16+
UseGoCoreUtils = v
1717
} else {
18-
useGoCoreUtils = runtime.GOOS == "windows"
18+
UseGoCoreUtils = runtime.GOOS == "windows"
1919
}
2020
}

internal/execext/exec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func ExpandFields(s string) ([]string, error) {
144144
}
145145

146146
func execHandlers() (handlers []func(next interp.ExecHandlerFunc) interp.ExecHandlerFunc) {
147-
if useGoCoreUtils {
147+
if UseGoCoreUtils {
148148
handlers = append(handlers, coreutils.ExecHandler)
149149
}
150150
return handlers

task.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,10 @@ func (e *Executor) runCommand(ctx context.Context, t *ast.Task, call *Call, i in
358358
if err != nil {
359359
var exitCode interp.ExitStatus
360360
if !errors.As(err, &exitCode) {
361-
// Convert the err to an interp.ExitStatus.
362-
e.Logger.Errf(logger.Default, "%v\n", err)
361+
if execext.UseGoCoreUtils {
362+
// Convert the err from CoreUtil to an interp.ExitStatus.
363+
e.Logger.Errf(logger.Default, "%v\n", err)
364+
}
363365
err = interp.ExitStatus(1)
364366
}
365367
if cmd.IgnoreError {

0 commit comments

Comments
 (0)