Skip to content

Commit

Permalink
test/e2e/s3: attach stdout & stderr to exec() errors
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 committed Dec 10, 2024
1 parent 4355d9e commit cdd63d6
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 @@ -407,8 +407,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;

Check failure on line 412 in test/e2e/s3/test.js

View workflow job for this annotation

GitHub Actions / standard-tests

Assignment to property of function parameter 'err'
err.stderr = stderr;

Check failure on line 413 in test/e2e/s3/test.js

View workflow job for this annotation

GitHub Actions / standard-tests

Assignment to property of function parameter 'err'
return reject(err);
}

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

0 comments on commit cdd63d6

Please sign in to comment.