mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-20 03:16:46 -07:00
fix(stats): address review follow-ups
This commit is contained in:
@@ -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[] = [];
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user