Skip to content

Commit 7bc01d7

Browse files
committed
[Telemetry] Fix death detection reliability by detaching watchdog process
1 parent 158df5c commit 7bc01d7

3 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/telemetry/watchdog-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class WatchdogClient {
4141
const spawner = options?.spawn ?? spawn;
4242
this.#childProcess = spawner(process.execPath, args, {
4343
stdio: ['pipe', 'ignore', 'ignore'],
44-
detached: false,
44+
detached: true,
4545
});
4646

4747
this.#childProcess.unref();

src/telemetry/watchdog/main.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ async function main() {
6767

6868
process.stdin.on('end', () => onParentDeath('stdin end'));
6969
process.stdin.on('close', () => onParentDeath('stdin close'));
70-
7170
process.on('disconnect', () => onParentDeath('ipc disconnect'));
7271

7372
const rl = readline.createInterface({

tests/telemetry/watchdog-client.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ describe('WatchdogClient', () => {
5959
assert.strictEqual(cmdArgs.includes('--parent-pid=100'), true);
6060
assert.strictEqual(cmdArgs.includes('--app-version=1.2.3'), true);
6161
assert.strictEqual(cmdArgs.includes('--os-type=2'), true);
62+
assert.strictEqual(spawnStub.firstCall.args[2].detached, true);
6263
});
6364

6465
it('passes log-file argument if provided', () => {

0 commit comments

Comments
 (0)