Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): macOS service install and restart from inside T3 hand off to launchd #28565

Openjuliusmarmingewants to merge 7 commits intomain fromrefs/pull/28565/headopened View on GitHub

Showing 3 changed files with 89 additions and 2 deletions (loading 1).

x
0 of 3 viewed, 3 left
1 addition and 1 deletionapps/server/src/cli/update.tsModified
View file
@@ -535,7 +535,7 @@
if (servicePlan?.handedOff === true) {
yield* Console.log(
- ` Background service switching to ${targetVersion} from a separate systemd unit, since this session runs inside it and disconnects when it restarts. Result: ${servicePlan.logPath}`,
+ ` Background service switching to ${targetVersion} from outside the service, since this session runs inside it and disconnects when it restarts. Result: ${servicePlan.logPath}`,
} else if (servicePlan !== undefined && restartService) {
yield* Console.log(` Background service restarted on ${targetVersion}`);
88 additions and 1 deletionapps/server/src/cloud/bootService.test.tsModified
View file
@@ -103,6 +103,8 @@
​
const commands: string[] = [];
const invocations: ProcessRunner.ProcessRunInput[] = [];
+ // launchd reads a plist at bootstrap; the handoff removes its own afterwards.
+ const handoffJobs: string[] = [];
const timeouts = new Map<string, unknown>();
const control: {
failCommand: string | undefined;
@@ -123,6 +125,10 @@
const command = `${input.command} ${input.args.join(" ")}`;
commands.push(command);
invocations.push(input);
+ const bootstrapped = input.command === "launchctl" ? input.args[2] : undefined;
+ if (input.args[0] === "bootstrap" && bootstrapped?.includes(".handoff.") === true) {
+ handoffJobs.push(yield* fs.readFileString(bootstrapped).pipe(Effect.orDie));