Skip to content
Myr

return the child process instead of a promise. (#18)

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

authored by James Talmage · committed by Sindre Sorhus · parent 3d31e8d · Browse files · 3 files+13 added−7 removed
This commit

State

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

Diff stats

3 files+13 added−7 removed

  • other:+13 added−7 removed

3 files+13 added−7 removed

modified:index.js+3 added-3 removed
modified:readme.md+4 added-4 removed
59 unmodified lines
60Execute a file.6162Same options as [`child_process.execFile`](https://nodejs.org/api/child_process.html#child_process_child_process_execfile_file_args_options_callback).6364Returns a promise for a result object with `stdout` and `stderr` properties.64Returns a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess).6566The promise instance has a `pid` property (ID of the child process) and a `kill` method (for sending signals to the child process).66The `child_process` instance is enhanced to also be promise for a result object with `stdout` and `stderr` properties.6768### execa.shell(command, [options])6970Execute a command through the system shell. Prefer `execa()` whenever possible, as it's both faster and safer.7172Same options as [`child_process.exec`](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback).7374Returns a promise for a result object with `stdout` and `stderr` properties.74Returns a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess).7576The promise instance has a `pid` property (ID of the child process) and a `kill` method (for sending signals to the child process).76The `child_process` instance is enhanced to also be promise for a result object with `stdout` and `stderr` properties.7778### execa.spawn(file, [arguments], [options])7980Spawn a file.
49 unmodified lines
modified:test.js+6 added
84 unmodified lines
85 const {stdout} = await m('stdin', {input: s});86 t.is(stdout, 'howdy');87});8889test('you can write to child.stdin', async t => {90 const child = m('stdin');91 child.stdin.end('unicorns');92 t.is((await child).stdout, 'unicorns');93});9495test('input option can be a String - sync', async t => {96 const stdout = m.sync('stdin', {input: 'foobar'});97 t.is(stdout, 'foobar');98});
18 unmodified lines