Better tmpdir cleanup

If expanding the runners fails, don't leave a corrupt/incomplete payloads dir
We now write a pid file out to the tmpdir, which allows us to scan for stale tmpdirs
and remove this as long as there isn't still a process running.
This commit is contained in:
Daniel Hiltgen
2024-03-13 11:43:45 -07:00
parent 7ed3e94105
commit 74788b487c
2 changed files with 52 additions and 1 deletions

View File

@@ -196,7 +196,13 @@ func extractDynamicLibs(payloadsDir, glob string) ([]string, error) {
return nil
})
}
return libs, g.Wait()
err = g.Wait()
if err != nil {
// If we fail to extract, the payload dir is unusable, so cleanup whatever we extracted
gpu.Cleanup()
return nil, err
}
return libs, nil
}
func verifyDriverAccess() error {