Skip to content

Commit

Permalink
remove exit error types
Browse files Browse the repository at this point in the history
  • Loading branch information
kmoe committed Jan 10, 2023
1 parent e83dcd9 commit 512b45a
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 439 deletions.
8 changes: 4 additions & 4 deletions tfexec/cmd_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (tf *Terraform) runTerraformCmd(ctx context.Context, cmd *exec.Cmd) error {
err = ctx.Err()
}
if err != nil {
return tf.wrapExitError(ctx, err, "")
return err
}

var errStdout, errStderr error
Expand All @@ -70,15 +70,15 @@ func (tf *Terraform) runTerraformCmd(ctx context.Context, cmd *exec.Cmd) error {
err = ctx.Err()
}
if err != nil {
return tf.wrapExitError(ctx, err, errBuf.String())
return err
}

// Return error if there was an issue reading the std out/err
if errStdout != nil && ctx.Err() != nil {
return tf.wrapExitError(ctx, errStdout, errBuf.String())
return errStdout
}
if errStderr != nil && ctx.Err() != nil {
return tf.wrapExitError(ctx, errStderr, errBuf.String())
return errStderr
}

return nil
Expand Down
8 changes: 4 additions & 4 deletions tfexec/cmd_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (tf *Terraform) runTerraformCmd(ctx context.Context, cmd *exec.Cmd) error {
err = ctx.Err()
}
if err != nil {
return tf.wrapExitError(ctx, err, "")
return err
}

var errStdout, errStderr error
Expand All @@ -75,15 +75,15 @@ func (tf *Terraform) runTerraformCmd(ctx context.Context, cmd *exec.Cmd) error {
err = ctx.Err()
}
if err != nil {
return tf.wrapExitError(ctx, err, errBuf.String())
return err
}

// Return error if there was an issue reading the std out/err
if errStdout != nil && ctx.Err() != nil {
return tf.wrapExitError(ctx, errStdout, errBuf.String())
return errStdout
}
if errStderr != nil && ctx.Err() != nil {
return tf.wrapExitError(ctx, errStderr, errBuf.String())
return errStderr
}

return nil
Expand Down
Loading

0 comments on commit 512b45a

Please sign in to comment.