Skip to content

fix(core): handle exec errors and fix tool container cleanup loop#3159

Merged
hellt merged 1 commit intosrl-labs:mainfrom
Aprazor:fix/exec-nil-result-and-destroy-early-return
Apr 14, 2026
Merged

fix(core): handle exec errors and fix tool container cleanup loop#3159
hellt merged 1 commit intosrl-labs:mainfrom
Aprazor:fix/exec-nil-result-and-destroy-early-return

Conversation

@Aprazor
Copy link
Copy Markdown
Contributor

@Aprazor Aprazor commented Apr 12, 2026

Two fixes in core/:

  • exec.go: when RunExec fails with a non-ErrRunExecNotSupported error, the nil execResult was still added to the collection, causing a nil dereference panic on Log()/Dump(). Also switched to errors.Is for the sentinel check.
  • destroy.go: deleteToolContainers used return instead of continue in a loop over tool types (["sshx", "gotty"]). If the sshx listing failed or found zero results, gotty containers were never cleaned up.

Testing

  • go vet ./core/... — clean
  • go test -race ./core/... — all pass

exec.go: when RunExec fails with a non-ErrRunExecNotSupported error,
the nil execResult was added to the collection, causing a panic on
Log()/Dump(). Also use errors.Is instead of == for sentinel check.

destroy.go: deleteToolContainers used return instead of continue in
a loop over tool types. If sshx listing failed or found zero results,
gotty containers were never cleaned up.
@hellt hellt merged commit a10a919 into srl-labs:main Apr 14, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants