fix(agent): give launchd units a log sink (StandardOut/ErrorPath)
launchd has no default log destination (unlike systemd's journald), so a unit
that fails to start (bare node, missing env) was silent — which hid the EX_CONFIG
+ loadConfig failures during this deploy. Route both units' stdout+stderr to
<stateDir>/{base-app,agent}.log. 281 tests pass.
This commit is contained in:
@@ -78,6 +78,7 @@ export function buildLaunchdPlist(
|
||||
programArguments: readonly string[],
|
||||
env: ServiceEnv = {},
|
||||
label: string = AGENT_LABEL,
|
||||
logPath?: string,
|
||||
): string {
|
||||
return [
|
||||
'<?xml version="1.0" encoding="UTF-8"?>',
|
||||
@@ -91,6 +92,16 @@ export function buildLaunchdPlist(
|
||||
' <true/>',
|
||||
' <key>KeepAlive</key>',
|
||||
' <true/>',
|
||||
// launchd's default has no log sink (unlike systemd's journald), so a crashing unit is silent.
|
||||
// Route stdout+stderr to a file so `pair --install` failures are diagnosable out of the box.
|
||||
...(logPath !== undefined
|
||||
? [
|
||||
' <key>StandardOutPath</key>',
|
||||
` <string>${escapeXml(logPath)}</string>`,
|
||||
' <key>StandardErrorPath</key>',
|
||||
` <string>${escapeXml(logPath)}</string>`,
|
||||
]
|
||||
: []),
|
||||
...environmentVariablesBlock(env),
|
||||
'</dict>',
|
||||
'</plist>',
|
||||
|
||||
Reference in New Issue
Block a user