Skip to content

Commit d57e5e9

Browse files
committed
fix: Show build output in post install
1 parent 2a9e167 commit d57e5e9

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

.github/workflows/build-test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ jobs:
3636
node-version: 22
3737
cache: pnpm
3838

39-
- run: pnpm install
39+
- name: Install dependencies
40+
env:
41+
SKIP_RUST_BUILD: 1
42+
run: pnpm install
4043

4144
- run: pnpm run ci
4245

scripts/postinstall.js

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const unzipper = require('unzipper');
1515
const os = require('node:os');
1616
const { mkdirp } = require('mkdirp');
1717
const { resolve } = require('node:path');
18-
const { exec } = require('node:child_process');
18+
const { exec, spawn } = require('node:child_process');
1919
const downloadTestCerts = require('./lib/download-test-certs.js');
2020
const { promisify } = require('node:util');
2121

@@ -162,13 +162,30 @@ async function buildRust(root) {
162162
const bindingsPath = resolve(generatedDir, 'c2pa.node');
163163
const cargoPath = resolve(root, 'Cargo.toml');
164164
await mkdirp(generatedDir);
165+
165166
return new Promise((resolve, reject) => {
166-
const result = exec(
167-
`npx cargo-cp-artifact -nc "${bindingsPath}" -- cargo build --message-format=json-render-diagnostics --release --manifest-path="${cargoPath}"`,
168-
execCallback,
169-
);
170-
result.on('exit', (code) => {
171-
code === 0 ? resolve() : reject();
167+
const child = spawn('npx', [
168+
'cargo-cp-artifact',
169+
'-nc', bindingsPath,
170+
'--',
171+
'cargo', 'build',
172+
'--message-format=json-render-diagnostics',
173+
'--release',
174+
`--manifest-path=${cargoPath}`
175+
], {
176+
stdio: 'inherit' // This will show real-time output
177+
});
178+
179+
child.on('exit', (code) => {
180+
if (code === 0) {
181+
resolve();
182+
} else {
183+
reject(new Error(`Cargo build failed with exit code ${code}`));
184+
}
185+
});
186+
187+
child.on('error', (err) => {
188+
reject(err);
172189
});
173190
});
174191
}

0 commit comments

Comments
 (0)