macOS: ensure /tmp/clawdbot exists for launchd logs

This commit is contained in:
Roshan Singh
2026-01-14 16:06:26 +00:00
committed by Peter Steinberger
parent 5b23f847d6
commit aaae327563
2 changed files with 30 additions and 2 deletions

View File

@@ -0,0 +1,21 @@
import Foundation
import Testing
@testable import Clawdbot
@Suite struct LogLocatorTests {
@Test func launchdGatewayLogPathEnsuresTmpDirExists() throws {
let dirPath = "/tmp/clawdbot"
let fm = FileManager.default
// Simulate a clean machine state where /tmp/clawdbot does not exist.
if fm.fileExists(atPath: dirPath) {
try? fm.removeItem(atPath: dirPath)
}
_ = LogLocator.launchdGatewayLogPath
var isDir: ObjCBool = false
#expect(fm.fileExists(atPath: dirPath, isDirectory: &isDir))
#expect(isDir.boolValue == true)
}
}