Skip to content

Commit 2f276eb

Browse files
committed
fix(update): self-launch workers in standalone builds
1 parent 9256f6d commit 2f276eb

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎src/update/job.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -550,14 +550,12 @@ export function spawnGuiUpdateWorker(
550550
channel: Channel,
551551
restart: boolean,
552552
): UpdateWorkerProcess {
553-
const script = process.argv[1];
554-
const args = [
555-
script,
553+
const args = selfLaunchArgv([
556554
"__gui-update-worker",
557555
jobId,
558556
channel,
559557
restart ? "restart" : "no-restart",
560-
];
558+
]);
561559
if (process.platform !== "win32") {
562560
return spawn(process.execPath, args, {
563561
detached: true,

‎src/update/notify.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { join } from "node:path";
44
import { createInterface } from "node:readline/promises";
55
import { atomicWriteFile, getConfigDir } from "../config";
66
import { hasStarPromptRun } from "../cli/star-prompt";
7+
import { selfLaunchArgv } from "../lib/self-launch-argv";
78
import {
89
type Channel,
910
currentVersion,
@@ -166,9 +167,10 @@ function cacheIsStale(cache: VersionCache | null): boolean {
166167
export function triggerBackgroundRefreshIfStale(channel: Channel, cache: VersionCache | null): void {
167168
if (!cacheIsStale(cache)) return;
168169
try {
169-
const entry = process.argv[1];
170-
if (!entry || !existsSync(entry)) return;
171-
const child = spawn(process.execPath, [entry, "__refresh-version", channel], {
170+
const commandArgs = ["__refresh-version", channel];
171+
const args = selfLaunchArgv(commandArgs);
172+
if (args.length > commandArgs.length && (!args[0] || !existsSync(args[0]))) return;
173+
const child = spawn(process.execPath, args, {
172174
detached: true,
173175
stdio: "ignore",
174176
windowsHide: true,

0 commit comments

Comments
 (0)