Skip to content

Commit

Permalink
fix: check combined outputs for potential errors when getting bacalha…
Browse files Browse the repository at this point in the history
…u job id (#175)

fix: check combined outputs for potentiall errors when getting bacalhau job id
  • Loading branch information
AquiGorka authored Jun 20, 2024
1 parent ec4bebf commit 9164626
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/executor/bacalhau/bacalhau.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,16 @@ func (executor *BacalhauExecutor) getJobID(
)
runCmd.Env = executor.bacalhauEnv

runOutput, err := runCmd.CombinedOutput()
runOutputRaw, err := runCmd.CombinedOutput()
if err != nil {
return "", fmt.Errorf("error running command %s -> %s, %s", deal.ID, err.Error(), runOutput)
return "", fmt.Errorf("error running command %s -> %s, %s", deal.ID, err.Error(), runOutputRaw)
}
splitOutputs := strings.Split(string(runOutputRaw), "\n")
runOutput := splitOutputs[0]
outputError := strings.Join(strings.Fields(strings.Join(splitOutputs[1:], " ")), " ")

if outputError != "" {
return "", fmt.Errorf("error running command %s -> %s, %s", deal.ID, outputError, runOutput)
}

id := strings.TrimSpace(string(runOutput))
Expand Down

0 comments on commit 9164626

Please sign in to comment.