fix: address CodeRabbit review feedback

This commit is contained in:
2026-03-22 19:37:49 -07:00
parent 8da3a26855
commit d65575c80d
33 changed files with 678 additions and 67 deletions

View File

@@ -558,7 +558,7 @@ export function buildSubminerScriptOpts(
const parts = [
`subminer-binary_path=${sanitizeScriptOptValue(appPath)}`,
`subminer-socket_path=${sanitizeScriptOptValue(socketPath)}`,
...extraParts,
...extraParts.map(sanitizeScriptOptValue),
];
if (logLevel !== 'info') {
parts.push(`subminer-log_level=${sanitizeScriptOptValue(logLevel)}`);

View File

@@ -75,11 +75,5 @@ export async function runJellyfinCommand(context: LauncherCommandContext): Promi
return true;
}
return Boolean(
args.jellyfin ||
args.jellyfinLogin ||
args.jellyfinLogout ||
args.jellyfinPlay ||
args.jellyfinDiscovery,
);
return false;
}

View File

@@ -4,6 +4,7 @@ import path from 'node:path';
import { getDefaultLauncherLogFile, getDefaultMpvLogFile } from './types.js';
test('getDefaultMpvLogFile uses APPDATA on windows', () => {
const today = new Date().toISOString().slice(0, 10);
const resolved = getDefaultMpvLogFile({
platform: 'win32',
homeDir: 'C:\\Users\\tester',
@@ -17,13 +18,14 @@ test('getDefaultMpvLogFile uses APPDATA on windows', () => {
'C:\\Users\\tester\\AppData\\Roaming',
'SubMiner',
'logs',
`mpv-${new Date().toISOString().slice(0, 10)}.log`,
`mpv-${today}.log`,
),
),
);
});
test('getDefaultLauncherLogFile uses launcher prefix', () => {
const today = new Date().toISOString().slice(0, 10);
const resolved = getDefaultLauncherLogFile({
platform: 'linux',
homeDir: '/home/tester',
@@ -36,7 +38,7 @@ test('getDefaultLauncherLogFile uses launcher prefix', () => {
'.config',
'SubMiner',
'logs',
`launcher-${new Date().toISOString().slice(0, 10)}.log`,
`launcher-${today}.log`,
),
);
});

View File

@@ -789,7 +789,8 @@ function stopManagedOverlayApp(args: Args): void {
const stopArgs = ['--stop'];
if (args.logLevel !== 'info') stopArgs.push('--log-level', args.logLevel);
const result = spawnSync(state.appPath, stopArgs, {
const target = resolveAppSpawnTarget(state.appPath, stopArgs);
const result = spawnSync(target.command, target.args, {
stdio: 'ignore',
env: buildAppEnv(),
});
@@ -919,7 +920,7 @@ export function runAppCommandWithInherit(appPath: string, appArgs: string[]): vo
proc.once('error', (error) => {
fail(`Failed to run app command: ${error.message}`);
});
proc.once('exit', (code) => {
proc.once('close', (code) => {
process.exit(code ?? 0);
});
}
@@ -970,7 +971,7 @@ export function runAppCommandAttached(
proc.once('error', (error) => {
reject(error);
});
proc.once('exit', (code, signal) => {
proc.once('close', (code, signal) => {
if (code !== null) {
resolve(code);
} else if (signal) {

View File

@@ -310,6 +310,7 @@ test(
const appStartPath = path.join(smokeCase.artifactsDir, 'fake-app-start.log');
const appStopPath = path.join(smokeCase.artifactsDir, 'fake-app-stop.log');
await waitForJsonLines(appStartPath, 1);
await waitForJsonLines(appStopPath, 1);
const appStartEntries = readJsonLines(appStartPath);
const appStopEntries = readJsonLines(appStopPath);