improve: enhance error reporting in build_binaries.js

- Check stderr, stdout, and message for comprehensive error info
- Format multi-line errors with proper indentation
- Ensures all error details are visible for debugging CI failures
This commit is contained in:
Daniel Young Lee
2025-08-10 13:37:15 -07:00
parent 55747791ba
commit 49abf1fe16
+22 -11
View File
@@ -49,14 +49,18 @@ for (const { name, target } of targets) {
console.log(`Building ${name}...`); console.log(`Building ${name}...`);
try { try {
execFileSync('bun', [ execFileSync(
'build', 'bun',
'--compile', [
`--target=${target}`, 'build',
bundleJs, '--compile',
'--outfile', `--target=${target}`,
outputPath bundleJs,
], { stdio: ['pipe', 'pipe', 'pipe'] }); '--outfile',
outputPath,
],
{ stdio: ['pipe', 'pipe', 'pipe'] },
);
if (fs.existsSync(outputPath)) { if (fs.existsSync(outputPath)) {
const stats = fs.statSync(outputPath); const stats = fs.statSync(outputPath);
@@ -68,9 +72,16 @@ for (const { name, target } of targets) {
} }
} catch (error) { } catch (error) {
console.error(` ✗ Failed to build ${name}`); console.error(` ✗ Failed to build ${name}`);
console.error(` ${error.message}`); const errorDetails =
if (error.stderr) { error.stderr || error.stdout || error.message || 'Unknown error';
console.error(` ${error.stderr.toString()}`); const errorString = errorDetails.toString().trim();
if (errorString) {
console.error(
errorString
.split('\n')
.map((line) => ` ${line}`)
.join('\n'),
);
} }
failedTargets.push(name); failedTargets.push(name);
} }