Skip to content
Myr

Do not output stderr and stdout on stdio inherit - fixes #70 (#79)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sam Verschueren · committed by Sindre Sorhus · parent f28c01d · Browse files · 2 files+7 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+7 added−1 removed

  • other:+7 added−1 removed

2 files+7 added−1 removed

modified:index.js+2 added-1 removed
204 unmodified lines
205 }206207 if (err || code !== 0 || signal !== null) {208 if (!err) {209 const output = parsed.opts.stdio === 'inherit' ? '' : `\n${stderr}${stdout}`;209 err = new Error(`Command failed: ${joinedCmd}\n${stderr}${stdout}`);210 err = new Error(`Command failed: ${joinedCmd}${output}`);211 err.code = code < 0 ? errname(code) : code;212 }213214 // TODO: missing some timeout logic for killed
74 unmodified lines
modified:test.js+5 added
40 unmodified lines
41 t.regex(err.message, /stdout/);42 t.regex(err.message, /stderr/);43});4445test('do not include in errors when `stdio` is set to `inherit`', async t => {46 const err = await t.throws(m('fixtures/error-message.js', {stdio: 'inherit'}));47 t.notRegex(err.message, /\\n/);48});4950test('execa.shell()', async t => {51 const {stdout} = await m.shell('node fixtures/noop foo');52 t.is(stdout, 'foo');53});
323 unmodified lines