From 528a9414df3f89212f71bc69b9561ff396fb34b9 Mon Sep 17 00:00:00 2001 From: ethernet Date: Fri, 11 Sep 2026 18:49:47 -0400 Subject: [PATCH] fix(build): type the python build helper's error handling for checkJs --- scripts/build/python.mjs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/build/python.mjs b/scripts/build/python.mjs index 9827884cd7..fc1218948b 100644 --- a/scripts/build/python.mjs +++ b/scripts/build/python.mjs @@ -15,8 +15,12 @@ export function runPython(args, options = {}) { if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { try { runPython(process.argv.slice(2)) - } catch (error) { - console.error('[python build]', error.message) - process.exitCode = Number.isInteger(error.status) && error.status !== 0 ? error.status : 1 + } catch (/** @type {unknown} */ error) { + // execFileSync throws a child_process exception carrying .status; anything + // else is reported as-is so a missing Python still prints a useful line. + const detail = error instanceof Error ? error.message : String(error) + console.error('[python build]', detail) + const status = typeof (/** @type {any} */ (error).status) === 'number' ? /** @type {any} */ (error).status : 0 + process.exitCode = status !== 0 ? status : 1 } }