fix(ci): restore launcher app capture helper export

This commit is contained in:
2026-03-01 15:58:19 -08:00
parent 18a555eb95
commit 8f47e0f7f2
2 changed files with 35 additions and 1 deletions

View File

@@ -5,7 +5,7 @@ import path from 'node:path';
import net from 'node:net'; import net from 'node:net';
import { EventEmitter } from 'node:events'; import { EventEmitter } from 'node:events';
import type { Args } from './types'; import type { Args } from './types';
import { startOverlay, state, waitForUnixSocketReady } from './mpv'; import { runAppCommandCaptureOutput, startOverlay, state, waitForUnixSocketReady } from './mpv';
import * as mpvModule from './mpv'; import * as mpvModule from './mpv';
function createTempSocketPath(): { dir: string; socketPath: string } { function createTempSocketPath(): { dir: string; socketPath: string } {
@@ -19,6 +19,18 @@ test('mpv module exposes only canonical socket readiness helper', () => {
assert.equal('waitForSocket' in mpvModule, false); assert.equal('waitForSocket' in mpvModule, false);
}); });
test('runAppCommandCaptureOutput captures status and stdio', () => {
const result = runAppCommandCaptureOutput(process.execPath, [
'-e',
'process.stdout.write("stdout-line"); process.stderr.write("stderr-line");',
]);
assert.equal(result.status, 0);
assert.equal(result.stdout, 'stdout-line');
assert.equal(result.stderr, 'stderr-line');
assert.equal(result.error, undefined);
});
test('waitForUnixSocketReady returns false when socket never appears', async () => { test('waitForUnixSocketReady returns false when socket never appears', async () => {
const { dir, socketPath } = createTempSocketPath(); const { dir, socketPath } = createTempSocketPath();
try { try {

View File

@@ -658,6 +658,28 @@ export function runAppCommandWithInherit(appPath: string, appArgs: string[]): ne
process.exit(result.status ?? 0); process.exit(result.status ?? 0);
} }
export function runAppCommandCaptureOutput(
appPath: string,
appArgs: string[],
): {
status: number;
stdout: string;
stderr: string;
error?: Error;
} {
const result = spawnSync(appPath, appArgs, {
env: buildAppEnv(),
encoding: 'utf8',
});
return {
status: result.status ?? 1,
stdout: result.stdout ?? '',
stderr: result.stderr ?? '',
error: result.error ?? undefined,
};
}
export function runAppCommandWithInheritLogged( export function runAppCommandWithInheritLogged(
appPath: string, appPath: string,
appArgs: string[], appArgs: string[],