Skip to content

Commit

Permalink
feat: added working dir
Browse files Browse the repository at this point in the history
  • Loading branch information
yindia committed Feb 12, 2025
1 parent fa90dc1 commit 33aaf63
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions task.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type Task struct {
Args []string // Command line arguments
Timeout time.Duration // Maximum execution time
Env []string // Additional environment variables
WorkingDir string // Working dir
Expected Output // Expected command output and behavior
Actual Output // Actual command output and results
SkipJsonNodes []string // JSON nodes to ignore in comparisons
Expand Down Expand Up @@ -116,6 +117,9 @@ func (t *Task) executeCommand() error {

cmd := exec.CommandContext(ctx, t.Command, t.Args...)
cmd.Env = append(os.Environ(), t.Env...)
if t.WorkingDir != "" {
cmd.Dir = t.WorkingDir
}

t.logger.Debug("Command: %s", t.Command+" "+strings.Join(t.Args, " "))
output, err := cmd.CombinedOutput()
Expand Down

0 comments on commit 33aaf63

Please sign in to comment.