Skip to content

Commit

Permalink
add disable version check flag
Browse files Browse the repository at this point in the history
  • Loading branch information
leaanthony committed Dec 6, 2024
1 parent ce62566 commit 36edfc8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
9 changes: 6 additions & 3 deletions setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
17 changes: 9 additions & 8 deletions task.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand All @@ -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 {
Expand Down

0 comments on commit 36edfc8

Please sign in to comment.