Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add execa.all() #192

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions index.js
Expand Up @@ -368,6 +368,11 @@ module.exports.stderr = async (...args) => {
return stderr;
};

module.exports.all = async (...args) => {
const {all} = await module.exports(...args);
return all;
};

module.exports.shell = (command, options) => handleShell(module.exports, command, options);

module.exports.sync = (command, args, options) => {
Expand Down
4 changes: 4 additions & 0 deletions readme.md
Expand Up @@ -122,6 +122,10 @@ Same as `execa()`, but returns only `stdout`.

Same as `execa()`, but returns only `stderr`.

### execa.all(file, [arguments], [options])

Same as `execa()`, but returns only `all`.

### execa.shell(command, [options])

Execute a command through the system shell. Prefer `execa()` whenever possible, as it's both faster and safer.
Expand Down
5 changes: 5 additions & 0 deletions test.js
Expand Up @@ -46,6 +46,11 @@ test('execa.stderr()', async t => {
t.is(stderr, 'foo');
});

test.serial('execa.all()', async t => {
const all = await execa.all('noop-132');
t.is(all, '132');
});

test.serial('result.all shows both `stdout` and `stderr` intermixed', async t => {
const result = await execa('noop-132');
t.is(result.all, '132');
Expand Down