Skip to content

Commit

Permalink
test/e2e/s3: attach stdout & stderr to exec() errors (#1340)
Browse files Browse the repository at this point in the history
It may not be immediately obvious that stdout and stderr are actually available when a call to `child_process.exec()` fails.  Attaching them here should bring attention to this, and aid future debugging.
  • Loading branch information
alxndrsn authored Dec 10, 2024
1 parent 7bb0360 commit 2971c71
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/e2e/s3/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,12 @@ function cli(cmd) {
const env = { ..._.pick(process.env, 'PATH'), NODE_CONFIG_ENV:'s3-dev' };

const promise = new Promise((resolve, reject) => {
const child = exec(cmd, { env, cwd:'../../..' }, (err, stdout) => {
if (err) return reject(err);
const child = exec(cmd, { env, cwd:'../../..' }, (err, stdout, stderr) => {
if (err) {
err.stdout = stdout; // eslint-disable-line no-param-reassign
err.stderr = stderr; // eslint-disable-line no-param-reassign
return reject(err);
}

const res = stdout.toString().trim();
log.debug('cli()', 'returned:', res);
Expand Down

0 comments on commit 2971c71

Please sign in to comment.