mirror of
https://github.com/rclone/rclone.git
synced 2026-05-12 10:03:35 -04:00
Until now test_all relied entirely on per-goroutine defer finish() calls in fstest/runs to stop test servers. A Ctrl-C, kill, or panic aborted those defers and left docker containers running, breaking the next run. Register testserver.CleanupAll with lib/atexit so SIGINT/SIGTERM delivery runs the sweep automatically. Also defer atexit.Run for the normal exit and unrecovered-panic paths, and call it explicitly before os.Exit(1) since os.Exit does not fire defers. The fs.Fatalf call sites above only fire before any server starts so they need no explicit sweep.