mirror of
https://github.com/munki/munki.git
synced 2026-01-25 00:19:39 -06:00
When a Launchd job should not be cleaned up when managedsoftwareupdate exits, do not use a Munki-managed temp directory; use a temp direcotry created under /private/tmp
This commit is contained in:
@@ -110,9 +110,16 @@ class LaunchdJob {
|
||||
// need to use a different tmpdir than the shared one,
|
||||
// which will get cleaned up when managedsoftwareupdate
|
||||
// exits
|
||||
tmpdir = TempDir().path
|
||||
tmpdir = "/private/tmp/munki-\(UUID().uuidString)"
|
||||
if let tmpdir {
|
||||
do {
|
||||
try FileManager.default.createDirectory(atPath: tmpdir, withIntermediateDirectories: true)
|
||||
} catch {
|
||||
// will be dealt with later when we check for existence of the tmpdir
|
||||
}
|
||||
}
|
||||
}
|
||||
guard let tmpdir else {
|
||||
guard let tmpdir, pathExists(tmpdir) else {
|
||||
throw MunkiError("Could not allocate temp dir for launchd job")
|
||||
}
|
||||
// label this job
|
||||
|
||||
Reference in New Issue
Block a user