Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flow: fix logic in os.Exec post run code #383

Merged
merged 2 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/hof.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jobs:
- 1.21.x
os:
- ubuntu-latest
- macos-13
environment: hof mod testing
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion ci/gha/common/vars.cue
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ Formatters: [
Versions: {
docker: "24.0.7"
go: "1.21.x" | ["1.22.x", "1.21.x"]
os: "ubuntu-latest" | ["ubuntu-latest", "macos-13"]
os: "ubuntu-latest" | ["ubuntu-latest"]
}
7 changes: 7 additions & 0 deletions flow.cue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ diff: F=_flow & {
build: F= _flow & {
@flow(build)

gha: {
_cond
shouldi: F._shouldi & { globs: ["ci/gha"] }
run: "make workflow"
}

gen: {
_cond
shouldi: F._shouldi & { globs: ["design/"] }
Expand All @@ -79,6 +85,7 @@ build: F= _flow & {

cli: {
_cond
#after: { $gen: F.gen }
shouldi: F._shouldi & { globs: ["go.*", "cmd/", "flow", "lib/", "schema/", "script/"] }
run: "go install ./cmd/hof"
}
Expand Down
17 changes: 9 additions & 8 deletions flow/tasks/os/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,6 @@ func (T *Exec) Run(ctx *hofcontext.Context) (interface{}, error) {
// build return value
ret := make(map[string]interface{})

if err != nil {
if doExit {
return nil, err
}

ret["error"] = err.Error()
}

//
// possibly fill stdout/stderr
//
Expand All @@ -122,6 +114,15 @@ func (T *Exec) Run(ctx *hofcontext.Context) (interface{}, error) {
ret["exitcode"] = cmd.ProcessState.ExitCode()
ret["success"] = cmd.ProcessState.Success()

// fmt.Println("GOT HERE", err, v, ret)

if err != nil {
if doExit {
return ret, err
}

ret["error"] = err.Error()
}
return ret, nil
}

Expand Down
Loading