MCPcopy Index your code
hub / github.com/foxcpp/maddy / killServer

Method killServer

tests/t.go:367–392  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

365}
366
367func (t *T) killServer() {
368 if err := t.servProc.Process.Signal(os.Interrupt); err != nil {
369 t.Log("Unable to kill the server process:", err)
370 assert.NoError(t, os.RemoveAll(t.testDir))
371 return // Return, as now it is pointless to wait for it.
372 }
373
374 go func() {
375 time.Sleep(5 * time.Second)
376 if t.servProc != nil {
377 t.Log("Killing possibly hung server process")
378 t.servProc.Process.Kill() //nolint:errcheck
379 }
380 }()
381
382 if err := t.servProc.Wait(); err != nil {
383 t.Error("The server did not stop cleanly, deadlock?")
384 }
385
386 t.servProc = nil
387
388 if err := os.RemoveAll(t.testDir); err != nil {
389 t.Log("Failed to remove test directory:", err)
390 }
391 t.testDir = ""
392}
393
394func (t *T) Close() {
395 t.Log("close is no-op")

Callers 1

reloadConfigMethod · 0.95

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected