


























@@ -37,6 +37,7 @@ const FAILURE_OUTPUT_TAIL_LINES = 40;
3737const STEP_OUTPUT_MAX_CHARS = 256 * 1024;
3838const STEP_PROCESS_GROUP_EXIT_POLL_MS = 25;
3939const STEP_POST_FORCE_KILL_WAIT_MS = 1_000;
40+const MAX_TIMER_TIMEOUT_MS = 2_147_000_000;
4041const SLOW_COMPILE_SUMMARY_LIMIT = 10;
4142const COMPILE_INPUT_EXTENSIONS = new Set([".ts", ".tsx", ".mts", ".cts", ".js", ".mjs", ".json"]);
4243const ROOTDIR_BOUNDARY_CANARY_IMPORT_PATH =
@@ -337,13 +338,22 @@ function writeStampFile(filePath) {
337338writeFileSync(filePath, `${new Date().toISOString()}\n`, "utf8");
338339}
339340341+function resolveStepTimerTimeoutMs(valueMs) {
342+const value = Number(valueMs);
343+if (!Number.isFinite(value)) {
344+return MAX_TIMER_TIMEOUT_MS;
345+}
346+return Math.min(Math.max(Math.floor(value), 1), MAX_TIMER_TIMEOUT_MS);
347+}
348+340349function runNodeStep(label, args, timeoutMs) {
350+const resolvedTimeoutMs = resolveStepTimerTimeoutMs(timeoutMs);
341351const startedAt = Date.now();
342352const result = spawnSync(process.execPath, args, {
343353cwd: repoRoot,
344354encoding: "utf8",
345355maxBuffer: 16 * 1024 * 1024,
346-timeout: timeoutMs,
356+timeout: resolvedTimeoutMs,
347357});
348358349359if (result.status === 0 && !result.error) {
@@ -352,7 +362,7 @@ function runNodeStep(label, args, timeoutMs) {
352362353363const timeoutSuffix =
354364result.error?.name === "Error" && result.error.message.includes("ETIMEDOUT")
355- ? `${label} timed out after ${timeoutMs}ms`
365+ ? `${label} timed out after ${resolvedTimeoutMs}ms`
356366 : "";
357367const errorSuffix = result.error ? result.error.message : "";
358368const note = [timeoutSuffix, errorSuffix].filter(Boolean).join("\n");
@@ -391,6 +401,7 @@ function abortSiblingSteps(abortController) {
391401 * Runs one node-based boundary check step with timeout and output capture.
392402 */
393403export function runNodeStepAsync(label, args, timeoutMs, params = {}) {
404+const resolvedTimeoutMs = resolveStepTimerTimeoutMs(timeoutMs);
394405const abortController = params.abortController;
395406const killProcess = params.killProcess ?? process.kill.bind(process);
396407const onFailure = params.onFailure;
@@ -499,7 +510,7 @@ export function runNodeStepAsync(label, args, timeoutMs, params = {}) {
499510stderr: stderrText,
500511kind: "timeout",
501512elapsedMs: Date.now() - startedAt,
502-note: `${label} timed out after ${timeoutMs}ms`,
513+note: `${label} timed out after ${resolvedTimeoutMs}ms`,
503514}),
504515),
505516label,
@@ -508,14 +519,14 @@ export function runNodeStepAsync(label, args, timeoutMs, params = {}) {
508519stderr: stderrText,
509520kind: "timeout",
510521elapsedMs: Date.now() - startedAt,
511-note: `${label} timed out after ${timeoutMs}ms`,
522+note: `${label} timed out after ${resolvedTimeoutMs}ms`,
512523},
513524);
514525onFailure?.(error);
515526abortSiblingSteps(abortController);
516527rejectPromise(toLintErrorObject(error, "Step timed out"));
517528})();
518-}, timeoutMs);
529+}, resolvedTimeoutMs);
519530520531child.stdout.setEncoding("utf8");
521532child.stderr.setEncoding("utf8");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。