Skip to content

Commit 085fe75

Browse files
steipeteJasmine Zhang
andcommitted
test(macos): isolate launch agent PATH coverage
Co-authored-by: Jasmine Zhang <[email protected]>
1 parent 2d653a1 commit 085fe75

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎apps/macos/Sources/OpenClaw/LaunchAgentManager.swift‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ enum LaunchAgentManager {
3030
try? plist.write(to: self.plistURL, atomically: true, encoding: .utf8)
3131
}
3232

33-
static func plistContents(bundlePath: String) -> String {
34-
let path = self.escapePlistText(CommandResolver.preferredPaths().joined(separator: ":"))
33+
static func plistContents(
34+
bundlePath: String,
35+
preferredPaths: [String] = CommandResolver.preferredPaths()) -> String
36+
{
37+
let path = self.escapePlistText(preferredPaths.joined(separator: ":"))
3538
let profileEnvironment = self.profileEnvironmentPlistEntries()
3639
return """
3740
<?xml version="1.0" encoding="UTF-8"?>

‎apps/macos/Tests/OpenClawIPCTests/LaunchAgentManagerTests.swift‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ struct LaunchAgentManagerTests {
2121
try await TestIsolation.withEnvValues([
2222
"OPENCLAW_CONFIG_PATH": " /tmp/custom&<openclaw>\"'.json ",
2323
"OPENCLAW_STATE_DIR": "/tmp/openclaw-state",
24-
"PATH": "/tmp/custom&<bin>",
2524
]) {
26-
let plist = LaunchAgentManager.plistContents(bundlePath: "/Applications/OpenClaw.app")
25+
let plist = LaunchAgentManager.plistContents(
26+
bundlePath: "/Applications/OpenClaw.app",
27+
preferredPaths: ["/tmp/custom&<bin>", "/usr/bin"])
2728
let data = try #require(plist.data(using: .utf8))
2829
let object = try #require(
2930
PropertyListSerialization.propertyList(from: data, format: nil) as? [String: Any])

0 commit comments

Comments
 (0)