Skip to content
Myr

add `execa.shellSync()`

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

authored by Sindre Sorhus · committed by Sindre Sorhus · parent f786349 · Browse files · 3 files+42 added−21 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+42 added−21 removed

  • other:+42 added−21 removed

3 files+42 added−21 removed

modified:index.js+28 added-20 removed
modified:readme.md+9 added-1 removed
83 unmodified lines
84### execa.sync(file, [arguments], [options])8586Execute a file synchronously.8788Same options as [`child_process.execFileSync`](https://nodejs.org/api/child_process.html#child_process_child_process_execfile_file_args_options_callback), except that the default encoding is `utf8` instead of `buffer`.88Same options as [`child_process.execFileSync`](https://nodejs.org/api/child_process.html#child_process_child_process_execfilesync_file_args_options), except the default encoding is `utf8` instead of `buffer`.8990Returns `stdout`.9192### execa.shellSync(file, [options])9394Execute a command synchronously through the system shell.9596Same options as [`child_process.execSync`](https://nodejs.org/api/child_process.html#child_process_child_process_execsync_command_options), except the default encoding is `utf8` instead of `buffer`.9798Returns `stdout`.99100### options101102Additional options:103
19 unmodified lines
modified:test.js+5 added
40 unmodified lines
41 const stdout = m.sync('noop', ['foo']);42 t.is(stdout, 'foo');43});4445test('execa.shellSync()', t => {46 const stdout = m.shellSync('node fixtures/noop foo');47 t.is(stdout, 'foo');48});4950test('stripEof option', async t => {51 const {stdout} = await m('noop', ['foo'], {stripEof: false});52 t.is(stdout, 'foo\n');53});
21 unmodified lines