diff --git a/setup.go b/setup.go index 5ded022ac6..e7c1be1261 100644 --- a/setup.go +++ b/setup.go @@ -46,9 +46,9 @@ func (e *Executor) Setup() error { if err := e.readDotEnvFiles(); err != nil { return err } - //if err := e.doVersionChecks(); err != nil { - // return err - //} + if err := e.doVersionChecks(); err != nil { + return err + } e.setupDefaults() e.setupConcurrencyState() return nil @@ -246,6 +246,9 @@ func (e *Executor) setupConcurrencyState() { } func (e *Executor) doVersionChecks() error { + if e.DisableVersionCheck { + return nil + } // Copy the version to avoid modifying the original schemaVersion := &semver.Version{} *schemaVersion = *e.Taskfile.Version diff --git a/task.go b/task.go index b183014271..ac570e680b 100644 --- a/task.go +++ b/task.go @@ -70,12 +70,13 @@ type Executor struct { Stdout io.Writer Stderr io.Writer - Logger *logger.Logger - Compiler *compiler.Compiler - Output output.Output - OutputStyle ast.Output - TaskSorter sort.TaskSorter - UserWorkingDir string + Logger *logger.Logger + Compiler *compiler.Compiler + Output output.Output + OutputStyle ast.Output + TaskSorter sort.TaskSorter + UserWorkingDir string + DisableVersionCheck bool fuzzyModel *fuzzy.Model @@ -383,7 +384,7 @@ func (e *Executor) runCommand(ctx context.Context, t *ast.Task, call *ast.Call, if err != nil { return fmt.Errorf("task: failed to get variables: %w", err) } - stdOut, stdErr, close := outputWrapper.WrapWriter(e.Stdout, e.Stderr, t.Prefix, outputTemplater) + stdOut, stdErr, closer := outputWrapper.WrapWriter(e.Stdout, e.Stderr, t.Prefix, outputTemplater) err = execext.RunCommand(ctx, &execext.RunCommandOptions{ Command: cmd.Cmd, @@ -395,7 +396,7 @@ func (e *Executor) runCommand(ctx context.Context, t *ast.Task, call *ast.Call, Stdout: stdOut, Stderr: stdErr, }) - if closeErr := close(err); closeErr != nil { + if closeErr := closer(err); closeErr != nil { e.Logger.Errf(logger.Red, "task: unable to close writer: %v\n", closeErr) } if _, isExitError := interp.IsExitStatus(err); isExitError && cmd.IgnoreError {