Open locnnil opened 7 months ago
The issue isn't related to just cancellation via context. Reaching the timeout or deadline triggers the cancellation, which in turn kills the process. The same behavior should be expected when using os.Process.Kill
.
The affected functions are tested here: https://github.com/canonical/matter-snap-testing/blob/c15a6cdfc5419f574ce928f0ab1d29bab4cd37fd/utils/exec_test.go#L54-L65
and a recent run show that the timeout results in killing the process after 1 second:
=== RUN TestExec/context_timed_out
2024/02/20 16:06:41 [exec] sleep 3
...
--- PASS: TestExec (2.11s)
...
--- PASS: TestExec/context_timed_out (1.00s)
...
PASS
ok github.com/canonical/matter-snap-testing/utils 2.118s
If a process is expected to be killed after a timeout with
utils.ExecContext
orutils.ExecContextVerbose
when running inside a GH runner it's only killed the parent process and not the child ones.