回退 dev:all Tauri 时序控制
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m1s
Project CI / Backend tests (pull_request) Failing after 23s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m22s
Project CI / Frontend tests (pull_request) Successful in 2m8s
Project CI / Repository checks (pull_request) Failing after 15s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m42s
Project CI / Native shell tests (pull_request) Successful in 5m44s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 12m2s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 11m31s

保留无引号启动摘要表。

移除 Tauri 输出捕获、就绪标记和额外等待逻辑。

恢复启动器原有输出与启动时序说明。
This commit is contained in:
2026-10-01 19:28:43 +08:00
parent 76eadc692c
commit 5dfd231496
5 changed files with 8 additions and 67 deletions
+5 -44
View File
@@ -20,7 +20,6 @@ const rootReadyPollMs = 500;
const childGracefulTimeoutMs = 2_500;
const childForceTimeoutMs = 2_000;
const agcReadyPollMs = 500;
const tauriDevReadyMarker = '[ai-game-creator-shell] Tauri DevCommand 已启动';
const rootOnlyOptions = new Set([
'--database',
@@ -344,53 +343,19 @@ function waitForChildExit(child) {
});
}
function buildManagedSpawnOptions(env, { captureOutput = false } = {}) {
function buildManagedSpawnOptions(env) {
return {
cwd: repoRoot,
env,
stdio: captureOutput ? ['inherit', 'pipe', 'pipe'] : 'inherit',
stdio: 'inherit',
shell: process.platform === 'win32',
detached: process.platform !== 'win32',
windowsHide: process.platform === 'win32',
};
}
function createTauriReadyPromise(child) {
return new Promise((resolveReady) => {
let ready = false;
let output = '';
const resolveOnce = () => {
if (!ready) {
ready = true;
resolveReady();
}
};
const forward = (stream, target) => {
stream?.on('data', (chunk) => {
target.write(chunk);
output = `${output}${chunk.toString()}`.slice(-4096);
if (output.includes(tauriDevReadyMarker)) {
resolveOnce();
}
});
};
forward(child.stdout, process.stdout);
forward(child.stderr, process.stderr);
child.once('error', resolveOnce);
child.once('exit', resolveOnce);
});
}
function spawnManaged(command, args, env, options = {}) {
const child = spawn(command, args, buildManagedSpawnOptions(env, options));
child.tauriReadyPromise = options.captureOutput
? createTauriReadyPromise(child)
: Promise.resolve();
return child;
}
function waitForTauriProcess(child) {
return child?.tauriReadyPromise ?? Promise.resolve();
function spawnManaged(command, args, env) {
return spawn(command, args, buildManagedSpawnOptions(env));
}
function wait(ms) {
@@ -514,7 +479,6 @@ async function runDevAll(argv = process.argv.slice(2), dependencies = {}) {
const readState = dependencies.readState ?? (() => readDevStackState());
const waitForRoot = dependencies.waitForRoot ?? waitForRootStack;
const waitForAgc = dependencies.waitForAgc ?? waitForAgcFrontend;
const waitForTauri = dependencies.waitForTauri ?? waitForTauriProcess;
let rootChild = null;
let agcChild = null;
@@ -577,12 +541,9 @@ async function runDevAll(argv = process.argv.slice(2), dependencies = {}) {
}
console.log('[dev:all] 根开发栈已就绪,启动 AGC Vite 与 Tauri');
agcChild = spawnProcess(npmCommand, ['run', 'agc'], env, {
captureOutput: true,
});
agcChild = spawnProcess(npmCommand, ['run', 'agc'], env);
const agcExit = waitForChildExit(agcChild);
await waitForAgc(agcChild, endpoint);
await waitForTauri(agcChild);
if (rootChild.exitCode !== null || rootChild.signalCode !== null) {
throw new Error('根开发栈在 AGC 就绪前退出');
}