fix(stats): address review follow-ups

This commit is contained in:
2026-03-19 22:55:46 -07:00
parent 1932d2e25e
commit 544cd8aaa0
7 changed files with 192 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ import type { Args } from './types';
import {
cleanupPlaybackSession,
findAppBinary,
launchAppCommandDetached,
launchTexthookerOnly,
parseMpvArgString,
runAppCommandCaptureOutput,
@@ -109,6 +110,26 @@ test('launchTexthookerOnly exits non-zero when app binary cannot be spawned', ()
assert.equal(error.code, 1);
});
test('launchAppCommandDetached handles child process spawn errors', async () => {
let uncaughtError: Error | null = null;
const onUncaughtException = (error: Error) => {
uncaughtError = error;
};
process.once('uncaughtException', onUncaughtException);
try {
launchAppCommandDetached(
'/definitely-missing-subminer-binary',
[],
makeArgs({ logLevel: 'warn' }).logLevel,
'test',
);
await new Promise((resolve) => setTimeout(resolve, 50));
assert.equal(uncaughtError, null);
} finally {
process.removeListener('uncaughtException', onUncaughtException);
}
});
test('stopOverlay logs a warning when stop command cannot be spawned', () => {
const originalWrite = process.stdout.write;
const writes: string[] = [];

View File

@@ -958,6 +958,9 @@ export function launchAppCommandDetached(
detached: true,
env: buildAppEnv(),
});
proc.once('error', (error) => {
log('warn', logLevel, `${label}: failed to launch detached app: ${error.message}`);
});
proc.unref();
}