History

feat(connect): keep macOS hosts reachable after reboot

Theo Browne committed 3 months ago

Commit ec3c5f61 parent 90f391312 files · +690 −91Browse files

Showing the changes to packages (2 of 12 files). Show all

Unified · Split

2 files
  1. packages/contracts/src/environment.ts +2 −2
  2. packages/shared/src/hostProcess.ts +7 −0
packages/contracts/src/environment.ts+2−2
@@ -21,8 +21,8 @@ export const ExecutionEnvironmentPlatform = Schema.Struct({ · 20 unmodified lines
2121 export type ExecutionEnvironmentPlatform = typeof ExecutionEnvironmentPlatform.Type;
2222
2323 /** How a server can replace itself with another version when asked over RPC:
24− "boot-service" rewrites the systemd user unit and restarts it; "respawn"
25− installs the target version and respawns the foreground process. */
24+ "boot-service" hands off through its systemd unit or macOS LaunchAgent;
25+ "respawn" installs the target version and replaces the foreground process. */
2626 export const ServerSelfUpdateMethod = Schema.Literals(["boot-service", "respawn"]);
2727 export type ServerSelfUpdateMethod = typeof ServerSelfUpdateMethod.Type;
2828
packages/shared/src/hostProcess.ts+7−0
@@ -51,4 +51,11 @@ export const HostProcessArguments = Context.Reference<ReadonlyArray<string>>( · 50 unmodified lines
5151 },
5252 );
5353
54+export const HostProcessUserId = Context.Reference<number | null>(
55+ "@t3tools/shared/hostProcess/HostProcessUserId",
56+ {
57+ defaultValue: () => (typeof process.getuid === "function" ? process.getuid() : null),
58+ },
59+);
60+
5461 export const isHostWindows = Effect.map(HostProcessPlatform, (platform) => platform === "win32");