Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

execa

Package Overview
Dependencies
Maintainers
2
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

execa - npm Package Compare versions

Comparing version 3.2.0 to 3.3.0

7

index.d.ts

@@ -201,2 +201,9 @@ /// <reference types="node"/>

readonly windowsVerbatimArguments?: boolean;
/**
On Windows, do not create a new console window. Please note this also prevents `CTRL-C` [from working](https://github.com/nodejs/node/issues/29837) on Windows.
@default true
*/
readonly windowsHide?: boolean;
}

@@ -203,0 +210,0 @@

4

index.js

@@ -45,4 +45,4 @@ 'use strict';

all: false,
...options,
windowsHide: true
windowsHide: true,
...options
};

@@ -49,0 +49,0 @@

{
"name": "execa",
"version": "3.2.0",
"version": "3.3.0",
"description": "Process execution for humans",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -44,3 +44,3 @@ <img src="media/logo.svg" width="400">

Additional examples:
### Pipe the child process stdout to the parent

@@ -50,7 +50,11 @@ ```js

(async () => {
// Pipe the child process stdout to the current stdout
execa('echo', ['unicorns']).stdout.pipe(process.stdout);
execa('echo', ['unicorns']).stdout.pipe(process.stdout);
```
### Handling Errors
```js
const execa = require('execa');
(async () => {
// Catching an error

@@ -82,7 +86,17 @@ try {

// Cancelling a spawned process
})();
```
### Cancelling a spawned process
```js
const execa = require('execa');
(async () => {
const subprocess = execa('node');
setTimeout(() => {
subprocess.cancel();
}, 1000);
try {

@@ -94,5 +108,8 @@ await subprocess;

}
})();
})()
```
// Catching an error with a sync method
### Catching an error with the sync method
```js
try {

@@ -122,5 +139,11 @@ execa.sync('unknown', ['command']);

}
```
// Kill a process with SIGTERM, and after 2 seconds, kill it with SIGKILL
### Kill a process
Using SIGTERM, and after 2 seconds, kill it with SIGKILL.
```js
const subprocess = execa('node');
setTimeout(() => {

@@ -133,2 +156,3 @@ subprocess.kill('SIGTERM', {

## API

@@ -501,2 +525,9 @@

#### windowsHide
Type: `boolean`<br>
Default: `true`
On Windows, do not create a new console window. Please note this also prevents `CTRL-C` [from working](https://github.com/nodejs/node/issues/29837) on Windows.
#### nodePath *(for `.node()` only)*

@@ -518,2 +549,19 @@

### Retry on error
Gracefully handle failures by using automatic retries and exponential backoff with the [`p-retry`](https://github.com/sindresorhus/p-retry) package:
```js
const pRetry = require('p-retry');
const run = async () => {
const results = await execa('curl', ['-sSL', 'https://sindresorhus.com/unicorn']);
return results;
};
(async () => {
console.log(await pRetry(run, {retries: 5}));
})();
```
### Save and pipe output from a child process

@@ -520,0 +568,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc