Process execution for humans
{encoding: 'buffer'}
option. It is the same as {encoding: null}
, but preferred over it. (#572)https://github.com/sindresorhus/execa/compare/v8.0.0...v8.0.1
https://github.com/sindresorhus/execa/compare/v7.2.0...v8.0.0
cwd
error property (#565) f57fdechttps://github.com/sindresorhus/execa/compare/v7.1.1...v7.2.0
$.sync(options)`command`
is used instead of $(options).sync`command`
(#551)$`command argument${value}`
(#553)stdin
option when using $`command`
: it should be inherit
(#550)$
method to write Node.js scripts like zx. For more information, please see this blog post, this section and this page. Thanks @aaronccasanova for this great feature!import {$} from 'execa';
const branch = await $`git branch --show-current`;
await $`dep deploy --branch=${branch}`;
.pipeStdout()
, .pipeStderr()
and .pipeAll()
methods to redirect stdout
/stderr
to a file, a stream or another process.// Similar to `echo unicorns > stdout.txt` in Bash
await execa('echo', ['unicorns']).pipeStdout('stdout.txt');
// Similar to `echo unicorns 2> stdout.txt` in Bash
await execa('echo', ['unicorns']).pipeStderr('stderr.txt');
// Similar to `echo unicorns &> stdout.txt` in Bash
await execa('echo', ['unicorns'], {all: true}).pipeAll('all.txt');
inputFile
option to use a file as stdin
.// Similar to `cat < stdin.txt` in Bash
const {stdout} = await execa('cat', {inputFile: 'stdin.txt'});
console.log(stdout);
//=> 'unicorns'
verbose
option to print each command on stderr
before executing it. This can also be enabled by setting the NODE_DEBUG=execa
environment variable in the current process.> node file.js
unicorns
rainbows
> NODE_DEBUG=execa node file.js
[16:50:03.305] echo unicorns
unicorns
[16:50:03.308] echo rainbows
rainbows
end
event on streams when process fails (#518) 30c7a7aexecaNode
signature in index.d.ts
(#506) 1f7677chttps://github.com/sindresorhus/execa/compare/v6.1.0...v7.0.0
AbortController
(#490) c6e791acwd
and localDir
options to be URLs (#492) 93ab929https://github.com/sindresorhus/execa/compare/v6.0.0...v6.1.0
require('execa')
→ import {execa} from 'execa'
require('execa').sync
→ import {execaSync} from 'execa'
require('execa').command
→ import {execaCommand} from 'execa'
require('execa').commandSync
→ import {execaCommandSync} from 'execa'
require('execa').node
→ import {execaNode} from 'execa'
https://github.com/sindresorhus/execa/compare/v5.1.1...v6.0.0
https://github.com/sindresorhus/execa/compare/v5.1.0...v5.1.1
.escapedCommand
property to the results (#466) 712bafchttps://github.com/sindresorhus/execa/compare/v5.0.1...v5.1.0