test: fix flaky ipfswatch test (#11142)

Gracefully shutdown the ipfs node to ensure data is saved. Forceful shutdown is done if there is an error sending the interrupt signal to the process, such as on Windows.
This commit is contained in:
Andrew Gillis 2026-01-13 02:38:44 -08:00 committed by GitHub
parent 447109df64
commit 56bf782cc6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -86,7 +86,9 @@ func TestIPFSWatch(t *testing.T) {
// Kill ipfswatch to release the repo lock
if result.Cmd.Process != nil {
_ = result.Cmd.Process.Kill()
if err = result.Cmd.Process.Signal(os.Interrupt); err != nil {
_ = result.Cmd.Process.Kill()
}
_, _ = result.Cmd.Process.Wait()
}