Comparing version 3.2.0 to 3.3.0
@@ -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 @@ |
@@ -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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52934
966
626