Comparing version 7.2.0 to 8.0.0
@@ -209,6 +209,4 @@ import {type Buffer} from 'node:buffer'; | ||
When `AbortController.abort()` is called, [`.isCanceled`](https://github.com/sindresorhus/execa#iscanceled) becomes `false`. | ||
When `AbortController.abort()` is called, [`.isCanceled`](https://github.com/sindresorhus/execa#iscanceled) becomes `true`. | ||
*Requires Node.js 16 or later.* | ||
@example | ||
@@ -215,0 +213,0 @@ ``` |
@@ -13,3 +13,2 @@ import {Buffer} from 'node:buffer'; | ||
const NO_ESCAPE_REGEXP = /^[\w.-]+$/; | ||
const DOUBLE_QUOTES_REGEXP = /"/g; | ||
@@ -21,3 +20,3 @@ const escapeArg = arg => { | ||
return `"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\"')}"`; | ||
return `"${arg.replaceAll('"', '\\"')}"`; | ||
}; | ||
@@ -36,3 +35,3 @@ | ||
// Allow spaces to be escaped by a backslash if not meant as a delimiter | ||
const previousToken = tokens[tokens.length - 1]; | ||
const previousToken = tokens.at(-1); | ||
if (previousToken && previousToken.endsWith('\\')) { | ||
@@ -86,3 +85,3 @@ // Merge previous token with current one | ||
...tokens.slice(0, -1), | ||
`${tokens[tokens.length - 1]}${nextTokens[0]}`, | ||
`${tokens.at(-1)}${nextTokens[0]}`, | ||
...nextTokens.slice(1), | ||
@@ -89,0 +88,0 @@ ]; |
import os from 'node:os'; | ||
import onExit from 'signal-exit'; | ||
import {onExit} from 'signal-exit'; | ||
@@ -4,0 +4,0 @@ const DEFAULT_FORCE_KILL_TIMEOUT = 1000 * 5; |
import {createReadStream, readFileSync} from 'node:fs'; | ||
import {setTimeout} from 'node:timers/promises'; | ||
import {isStream} from 'is-stream'; | ||
import getStream from 'get-stream'; | ||
import getStream, {getStreamAsBuffer} from 'get-stream'; | ||
import mergeStream from 'merge-stream'; | ||
@@ -82,2 +83,5 @@ | ||
// Wait for the `all` stream to receive the last chunk before destroying the stream | ||
await setTimeout(0); | ||
stream.destroy(); | ||
@@ -97,9 +101,19 @@ | ||
if (encoding) { | ||
return getStream(stream, {encoding, maxBuffer}); | ||
// eslint-disable-next-line unicorn/text-encoding-identifier-case | ||
if (encoding === 'utf8' || encoding === 'utf-8') { | ||
return getStream(stream, {maxBuffer}); | ||
} | ||
return getStream.buffer(stream, {maxBuffer}); | ||
if (encoding === null) { | ||
return getStreamAsBuffer(stream, {maxBuffer}); | ||
} | ||
return applyEncoding(stream, maxBuffer, encoding); | ||
}; | ||
const applyEncoding = async (stream, maxBuffer, encoding) => { | ||
const buffer = await getStreamAsBuffer(stream, {maxBuffer}); | ||
return buffer.toString(encoding); | ||
}; | ||
// Retrieve result of child process: exit code, signal, error, streams (stdout/stderr/all) | ||
@@ -106,0 +120,0 @@ export const getSpawnedResult = async ({stdout, stderr, all}, {encoding, buffer, maxBuffer}, processDone) => { |
{ | ||
"name": "execa", | ||
"version": "7.2.0", | ||
"version": "8.0.0", | ||
"description": "Process execution for humans", | ||
@@ -14,5 +14,8 @@ "license": "MIT", | ||
"type": "module", | ||
"exports": "./index.js", | ||
"exports": { | ||
"types": "./index.d.ts", | ||
"default": "./index.js" | ||
}, | ||
"engines": { | ||
"node": "^14.18.0 || ^16.14.0 || >=18.0.0" | ||
"node": ">=16.17" | ||
}, | ||
@@ -47,4 +50,4 @@ "scripts": { | ||
"cross-spawn": "^7.0.3", | ||
"get-stream": "^6.0.1", | ||
"human-signals": "^4.3.0", | ||
"get-stream": "^8.0.1", | ||
"human-signals": "^5.0.0", | ||
"is-stream": "^3.0.0", | ||
@@ -54,16 +57,16 @@ "merge-stream": "^2.0.0", | ||
"onetime": "^6.0.0", | ||
"signal-exit": "^3.0.7", | ||
"signal-exit": "^4.1.0", | ||
"strip-final-newline": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^18.13.0", | ||
"@types/node": "^20.4.0", | ||
"ava": "^5.2.0", | ||
"c8": "^7.12.0", | ||
"get-node": "^13.5.0", | ||
"c8": "^8.0.1", | ||
"get-node": "^14.2.0", | ||
"is-running": "^2.1.0", | ||
"p-event": "^5.0.1", | ||
"p-event": "^6.0.0", | ||
"path-key": "^4.0.0", | ||
"tempfile": "^4.0.0", | ||
"tsd": "^0.25.0", | ||
"xo": "^0.54.2" | ||
"tempfile": "^5.0.0", | ||
"tsd": "^0.28.1", | ||
"xo": "^0.55.0" | ||
}, | ||
@@ -70,0 +73,0 @@ "c8": { |
@@ -25,3 +25,3 @@ <picture> | ||
<br> | ||
<a href="https://transloadit.com"> | ||
<a href="https://transloadit.com?utm_source=sindresorhus&utm_medium=referral&utm_campaign=sponsorship&utm_content=execa"> | ||
<picture> | ||
@@ -715,6 +715,4 @@ <source width="360" media="(prefers-color-scheme: dark)" srcset="https://sindresorhus.com/assets/thanks/transloadit-logo-dark.svg"> | ||
When `AbortController.abort()` is called, [`.isCanceled`](#iscanceled) becomes `false`. | ||
When `AbortController.abort()` is called, [`.isCanceled`](#iscanceled) becomes `true`. | ||
*Requires Node.js 16 or later.* | ||
#### windowsVerbatimArguments | ||
@@ -721,0 +719,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
79424
1456
823
+ Addedget-stream@8.0.1(transitive)
+ Addedhuman-signals@5.0.0(transitive)
+ Addedsignal-exit@4.1.0(transitive)
- Removedget-stream@6.0.1(transitive)
- Removedhuman-signals@4.3.1(transitive)
- Removedsignal-exit@3.0.7(transitive)
Updatedget-stream@^8.0.1
Updatedhuman-signals@^5.0.0
Updatedsignal-exit@^4.1.0