Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): macOS service starts even when launchd leaves it pending after bootstrap #29528

Openjuliusmarmingewants to merge 8 commits intomain fromrefs/pull/29528/headopened View on GitHub

Showing 2 changed files with 59 additions and 2 deletions.

x
0 of 2 viewed, 2 left
45 additions and 1 deletionapps/server/src/cloud/bootService.test.tsModified
View file
@@ -120,11 +120,18 @@
linger: string;
enabled: boolean;
active: boolean;
+ // launchd can load a bootstrapped job yet leave its RunAtLoad spawn pending.
+ bootstrapSpawns: boolean;
+ launchdLoaded: boolean;
+ launchdRunning: boolean;
} = {
failCommand: undefined,
linger: "yes",
enabled: true,
active: true,
+ bootstrapSpawns: true,
+ launchdLoaded: false,
+ launchdRunning: false,
const runner = ProcessRunner.ProcessRunner.of({
run: Effect.fn("test.run_boot_service_command")(function* (
@@ -134,13 +141,27 @@
commands.push(command);
invocations.push(input);
timeouts.set(command, input.timeout);
- const failed = command === control.failCommand;
+ const launchdVerb = input.command === "launchctl" ? input.args[0] : undefined;
+ // launchd rejects bootstrap of a loaded job and kickstart of an unloaded one.
+ const failed =
+ command === control.failCommand ||
+ (launchdVerb === "bootstrap" && control.launchdLoaded) ||