Improve error message when running manifest commands (#1723)

This commit is contained in:
toasted-nutbread 2021-05-31 14:20:35 -04:00 committed by GitHub
parent 003cf791b1
commit 983cdd2339
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,13 +72,14 @@ class ManifestUtil {
_evaluateModificationCommand(data) {
const {command, args, trim} = data;
const {stdout, status} = childProcess.spawnSync(command, args, {
const {stdout, stderr, status} = childProcess.spawnSync(command, args, {
cwd: __dirname,
stdio: 'pipe',
shell: false
});
if (status !== 0) {
throw new Error(`Failed to execute ${command} ${args.join(' ')}`);
const message = stderr.toString('utf8').trim();
throw new Error(`Failed to execute ${command} ${args.join(' ')}\nstatus=${status}\n${message}`);
}
let result = stdout.toString('utf8');
if (trim) { result = result.trim(); }