Releases: sindresorhus/execa
v9.5.1
v9.5.0
v9.4.1
v9.4.0
Features
- We've created a separate package called nano-spawn. It is similar to Execa but with fewer features, for a much smaller package size. More info.
Bug fixes
- Both
execaNode()
and thepreferLocal
option modify thePATH
environment variable. This release includes some minor improvements to ensure that environment variable remains small (sindresorhus/npm-run-path#20). It also handles a few related edge cases better (sindresorhus/npm-run-path#21).
Documentation
v9.3.1
Thanks @holic and @jimhigson for your contributions!
Bugs
- Do not crash when using a custom Node.js binary without ICU support. (#1144)
Bugs (types)
- Fix type of the
env
option. It was currently failing for Remix or Next.js users. (by @holic) (#1141)
Documentation
- Fix typo in "Inputs" documentation. (by @jimhigson) (#1145)
- Document how to terminate hanging subprocesses. (#1140)
- Document how to add custom logging. (#1131)
v9.3.0
Features
- The
verbose
option can now be a function to customize logging. (#1130)
v9.2.0
This release includes a new set of methods to exchange messages between the current process and a Node.js subprocess, also known as "IPC". This allows passing and returning almost any message type to/from a Node.js subprocess. Also, debugging IPC is now much easier.
Moreover, a new gracefulCancel
option has also been added to terminate a subprocess gracefully.
For a deeper dive-in, please check and share the release post!
Thanks @iiroj for your contribution, @SimonSiefke and @adymorz for reporting the bugs fixed in this release, and @karlhorky for improving the documentation!
Deprecations
- Passing
'ipc'
to thestdio
option has been deprecated. It will be removed in the next major release. Instead, theipc: true
option should be used. (#1056)
- await execa('npm', ['run', 'build'], {stdio: ['pipe', 'pipe', 'pipe', 'ipc']});
+ await execa('npm', ['run', 'build'], {ipc: true});
- The
execaCommand()
method has been deprecated. It will be removed in the next major release. If most cases, the template string syntax should be used instead.
- import {execaCommand} from 'execa';
+ import {execa} from 'execa';
- await execaCommand('npm run build');
+ await execa`npm run build`;
const taskName = 'build';
- await execaCommand(`npm run ${taskName}`);
+ await execa`npm run ${taskName}`;
const commandArguments = ['run', 'task with space'];
await execa`npm ${commandArguments}`;
If the file and/or multiple arguments are supplied as a single string, parseCommandString(command) can split that string into an array. More info. (#1054)
- import {execaCommand} from 'execa';
+ import {execa, parseCommandString} from 'execa';
const commandString = 'npm run task';
- await execaCommand(commandString);
+ const commandArray = parseCommandString(commandString); // ['npm', 'run', 'task']
+ await execa`${commandArray}`;
// Or alternatively:
const [file, ...commandArguments] = commandArray;
await execa(file, commandArguments);
Features
- Add
gracefulCancel
option andgetCancelSignal()
method to terminate a subprocess gracefully.error.isGracefullyCanceled
was also added. (#1109) - Add
error.isForcefullyTerminated
. It istrue
when the subprocess was terminated by theforceKillAfterDelay
option. (#1111) - New methods to simplify exchanging messages between the current process and the subprocess. More info. (#1059, #1061, #1076, #1077, #1079, #1082, #1083, #1086, #1087, #1088, #1089, #1090, #1091, #1092, #1094, #1095, #1098, #1104, #1107)
- The current process sends messages with
subprocess.sendMessage(message)
and receives them withsubprocess.getOneMessage()
.subprocess.getEachMessage()
listens to multiple messages. - The subprocess uses
sendMessage(message)
,getOneMessage()
andgetEachMessage()
instead. Those are the same methods, but imported directly from the'execa'
module.
- The current process sends messages with
- The
ipcInput
option sends an IPC message from the current process to the subprocess as it starts. This enables passing almost any input type to a Node.js subprocess. (#1068) - The
result.ipcOutput
array contains all the IPC messages sent by the subprocess to the current process. This enables returning almost any output type from a Node.js subprocess. (#1067, #1071, #1075) - The error message now contains every IPC message sent by the subprocess. (#1067)
- The
verbose: 'full'
option now logs every IPC message sent by the subprocess, for debugging. More info here and there. (#1063)
Types
- Add
ExecaMethod
,ExecaNodeMethod
andExecaScriptMethod
,ExecaSyncMethod
andExecaScriptSyncMethod
types. (#1066) - Export the
Message
type, for IPC. (#1059) - Fix type of
forceKillAfterDelay: true
option. (#1116)
Bug fixes
- Fix passing a
{file}
to both thestdin
and thestdout
orstderr
options. (#1058) - Fix multiple minor problems with the
cancelSignal
option. (#1108) - Fix accidental publishing of Vim backup files. (#1074)
- Fix
engines.node
field inpackage.json
. Supported Node.js version is^18.19.0
or>=20.5.0
. (by @iiroj) (#1101)