Skip to content

Commit

Permalink
fix(build): throw error when build fails (#6108)
Browse files Browse the repository at this point in the history
init var with a different name
  • Loading branch information
mabaasit authored Aug 13, 2024
1 parent 21ca06d commit 3623af0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/hadron-build/lib/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ function run(cmd, args, opts, fn) {
});

proc.on('exit', function(code) {
const _output = Buffer.concat(output).toString('utf-8');
if (code !== 0) {
const output = Buffer.concat(output).toString('utf-8');
debug('command failed!', { cmd, output });
debug('command failed!', { cmd, output: _output });
const error = new Error(`Command failed with exit code ${code}: ${cmd} ${args.join(' ')} [enable line-by-line output via 'DEBUG=hadron*']`);
error.output = {
output,
[util.inspect.custom]() { return util.inspect(output, { maxStringLength: Infinity }); }
output: _output,
[util.inspect.custom]() { return util.inspect(_output, { maxStringLength: Infinity }); }
};
fn(error);
return;
Expand All @@ -70,7 +70,7 @@ function run(cmd, args, opts, fn) {
cmd: cmd
});

fn(null, Buffer.concat(output).toString('utf-8'));
fn(null, _output);
});
}

Expand Down

0 comments on commit 3623af0

Please sign in to comment.