diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/debian/changelog node-execa-5.1.1+repack+~cs17.3.6/debian/changelog --- node-execa-4.1.0+dfsg+~cs19.3.6/debian/changelog 2021-11-12 18:37:41.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/debian/changelog 2021-12-01 11:56:50.000000000 +0000 @@ -1,3 +1,19 @@ +node-execa (5.1.1+repack+~cs17.3.6-1) unstable; urgency=medium + + * Team upload + * Replace embedded component strip-final-newline by dependency to virtual + node-strip-final-newline and repack + + -- Yadd Wed, 01 Dec 2021 12:56:50 +0100 + +node-execa (5.1.1+dfsg+~cs19.3.6-1) unstable; urgency=medium + + * Team upload + * Transition: don't install strip-final-newline in nodejs root directories + * New upstream version 5.1.1+dfsg+~cs19.3.6 + + -- Yadd Tue, 30 Nov 2021 14:50:32 +0100 + node-execa (4.1.0+dfsg+~cs19.3.6-6) unstable; urgency=medium * Team upload diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/debian/control node-execa-5.1.1+repack+~cs17.3.6/debian/control --- node-execa-4.1.0+dfsg+~cs19.3.6/debian/control 2021-11-12 18:36:42.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/debian/control 2021-12-01 11:39:57.000000000 +0000 @@ -16,6 +16,7 @@ , node-npm-run-path , node-shebang-command , node-signal-exit + , node-strip-final-newline , node-which Standards-Version: 4.6.0 Vcs-Browser: https://salsa.debian.org/js-team/node-execa @@ -33,6 +34,7 @@ , node-npm-run-path , node-shebang-command , node-signal-exit + , node-strip-final-newline , node-which Provides: ${nodejs:Provides} Description: better `child_process` diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/debian/gbp.conf node-execa-5.1.1+repack+~cs17.3.6/debian/gbp.conf --- node-execa-4.1.0+dfsg+~cs19.3.6/debian/gbp.conf 2020-11-26 10:33:23.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/debian/gbp.conf 2021-12-01 11:36:04.000000000 +0000 @@ -1,6 +1,6 @@ [DEFAULT] pristine-tar=True -component=['cross-spawn', 'human-signals', 'onetime', 'path-key', 'strip-final-newline'] +component=['cross-spawn', 'human-signals', 'onetime', 'path-key'] [import-orig] filter=[ '.gitignore', '.travis.yml', '.git*' ] diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/debian/nodejs/root_modules node-execa-5.1.1+repack+~cs17.3.6/debian/nodejs/root_modules --- node-execa-4.1.0+dfsg+~cs19.3.6/debian/nodejs/root_modules 2020-12-05 21:36:12.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/debian/nodejs/root_modules 2021-12-01 11:31:51.000000000 +0000 @@ -1,4 +1,3 @@ human-signals onetime path-key -strip-final-newline diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/debian/source/lintian-overrides node-execa-5.1.1+repack+~cs17.3.6/debian/source/lintian-overrides --- node-execa-4.1.0+dfsg+~cs19.3.6/debian/source/lintian-overrides 2021-04-14 19:22:41.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/debian/source/lintian-overrides 2021-12-01 11:31:51.000000000 +0000 @@ -1,4 +1,5 @@ # Test data -source-is-missing debian/tests/test_modules/test-each/build/src/title.js line length is 960 characters (>512) -source-contains-prebuilt-javascript-object debian/tests/test_modules/test-each/build/src/title.js line length is 960 characters (>512) -very-long-line-length-in-source-file debian/tests/test_modules/test-each/build/src/title.js line length is 960 characters (>512) +source-is-missing debian/tests/test_modules/test-each/build/src/title.js +source-contains-prebuilt-javascript-object debian/tests/test_modules/test-each/build/src/title.js +very-long-line-length-in-source-file debian/tests/test_modules/test-each/build/src/title.js line 2 is 960 characters long (>512) +very-long-line-length-in-source-file human-signals/.travis.yml line 33 is 702 characters long (>512) diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/debian/watch node-execa-5.1.1+repack+~cs17.3.6/debian/watch --- node-execa-4.1.0+dfsg+~cs19.3.6/debian/watch 2021-11-12 18:36:30.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/debian/watch 2021-12-01 11:37:50.000000000 +0000 @@ -1,6 +1,6 @@ version=4 opts=\ -repacksuffix=+dfsg,\ +repacksuffix=~dfsg,\ dversionmangle=auto,\ filenamemangle=s/.*?(\d[\d\.-]*@ARCHIVE_EXT@)/node-execa-$1/ \ https://github.com/sindresorhus/execa/tags .*/archive/.*/v?([\d\.]+).tar.gz group @@ -33,9 +33,3 @@ filenamemangle=s/.*?(\d[\d\.-]*@ARCHIVE_EXT@)/node-path-key-$1/ \ https://github.com/sindresorhus/path-key/tags .*/archive/.*/v?([\d\.]+).tar.gz checksum -opts=\ -ctype=nodejs,\ -component=strip-final-newline,\ -dversionmangle=auto,\ -filenamemangle=s/.*?(\d[\d\.-]*@ARCHIVE_EXT@)/node-strip-final-newline-$1/ \ - https://github.com/sindresorhus/strip-final-newline/tags .*/archive/.*/v?([\d\.]+).tar.gz checksum diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/.github/workflows/main.yml node-execa-5.1.1+repack+~cs17.3.6/.github/workflows/main.yml --- node-execa-4.1.0+dfsg+~cs19.3.6/.github/workflows/main.yml 1970-01-01 00:00:00.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/.github/workflows/main.yml 2021-06-04 16:34:39.000000000 +0000 @@ -0,0 +1,31 @@ +name: CI +on: + - push + - pull_request +jobs: + test: + name: Node.js ${{ matrix.node-version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + node-version: + - 16 + - 14 + - 12 + - 10 + os: + - ubuntu-latest + - macos-latest + - windows-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm test + - uses: codecov/codecov-action@v1 + if: matrix.os == 'ubuntu-latest' && matrix.node-version == 14 + with: + fail_ci_if_error: true diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/index.d.ts node-execa-5.1.1+repack+~cs17.3.6/index.d.ts --- node-execa-4.1.0+dfsg+~cs19.3.6/index.d.ts 2020-10-28 11:29:04.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/index.d.ts 2021-06-04 16:34:39.000000000 +0000 @@ -252,11 +252,21 @@ interface ExecaReturnBase { /** - The file and arguments that were run. + The file and arguments that were run, for logging purposes. + + This is not escaped and should not be executed directly as a process, including using `execa()` or `execa.command()`. */ command: string; /** + Same as `command` but escaped. + + This is meant to be copy and pasted into a shell, for debugging purposes. + Since the escaping is fairly basic, this should not be executed directly as a process, including using `execa()` or `execa.command()`. + */ + escapedCommand: string; + + /** The numeric exit code of the process that was run. */ exitCode: number; @@ -334,7 +344,7 @@ interface ExecaSyncError extends Error, - ExecaReturnBase { + ExecaReturnBase { /** Error message when the child process failed to run. In addition to the underlying error message, it also contains some information related to why the child process errored. @@ -384,6 +394,15 @@ } interface ExecaChildPromise { + /** + Stream combining/interleaving [`stdout`](https://nodejs.org/api/child_process.html#child_process_subprocess_stdout) and [`stderr`](https://nodejs.org/api/child_process.html#child_process_subprocess_stderr). + + This is `undefined` if either: + - the `all` option is `false` (the default value) + - both `stdout` and `stderr` options are set to [`'inherit'`, `'ipc'`, `Stream` or `integer`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio) + */ + all?: ReadableStream; + catch( onRejected?: (reason: ExecaError) => ResultType | PromiseLike ): Promise | ResultType>; @@ -391,26 +410,17 @@ /** Same as the original [`child_process#kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal), except if `signal` is `SIGTERM` (the default value) and the child process is not terminated after 5 seconds, force it by sending `SIGKILL`. */ - kill(signal?: string, options?: execa.KillOptions): void; + kill(signal?: string, options?: KillOptions): void; /** Similar to [`childProcess.kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal). This is preferred when cancelling the child process execution as the error is more descriptive and [`childProcessResult.isCanceled`](#iscanceled) is set to `true`. */ cancel(): void; - - /** - Stream combining/interleaving [`stdout`](https://nodejs.org/api/child_process.html#child_process_subprocess_stdout) and [`stderr`](https://nodejs.org/api/child_process.html#child_process_subprocess_stderr). - - This is `undefined` if either: - - the `all` option is `false` (the default value) - - both `stdout` and `stderr` options are set to [`'inherit'`, `'ipc'`, `Stream` or `integer`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio) - */ - all?: ReadableStream; } type ExecaChildProcess = ChildProcess & - ExecaChildPromise & - Promise>; + ExecaChildPromise & + Promise>; } declare const execa: { @@ -433,8 +443,13 @@ //=> 'unicorns' // Cancelling a spawned process + const subprocess = execa('node'); - setTimeout(() => { spawned.cancel() }, 1000); + + setTimeout(() => { + subprocess.cancel() + }, 1000); + try { await subprocess; } catch (error) { @@ -459,7 +474,7 @@ ): execa.ExecaChildProcess; (file: string, options?: execa.Options): execa.ExecaChildProcess; (file: string, options?: execa.Options): execa.ExecaChildProcess< - Buffer + Buffer >; /** @@ -492,7 +507,7 @@ If the file or an argument contains spaces, they must be escaped with backslashes. This matters especially if `command` is not a constant but a variable, for example with `__dirname` or `process.cwd()`. Except for spaces, no escaping/quoting is needed. - The `shell` option must be used if the `command` uses shell-specific features, as opposed to being a simple `file` followed by its `arguments`. + The `shell` option must be used if the `command` uses shell-specific features (for example, `&&` or `||`), as opposed to being a simple `file` followed by its `arguments`. @param command - The program/script to execute and its arguments. @returns A [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess), which is enhanced to also be a `Promise` for a result `Object` with `stdout` and `stderr` properties. diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/index.js node-execa-5.1.1+repack+~cs17.3.6/index.js --- node-execa-4.1.0+dfsg+~cs19.3.6/index.js 2020-10-28 11:29:04.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/index.js 2021-06-04 16:34:39.000000000 +0000 @@ -7,10 +7,10 @@ const onetime = require('onetime'); const makeError = require('./lib/error'); const normalizeStdio = require('./lib/stdio'); -const {spawnedKill, spawnedCancel, setupTimeout, setExitHandler} = require('./lib/kill'); -const {handleInput, getSpawnedResult, makeAllStream, validateInputSync} = require('./lib/stream.js'); -const {mergePromise, getSpawnedPromise} = require('./lib/promise.js'); -const {joinCommand, parseCommand} = require('./lib/command.js'); +const {spawnedKill, spawnedCancel, setupTimeout, validateTimeout, setExitHandler} = require('./lib/kill'); +const {handleInput, getSpawnedResult, makeAllStream, validateInputSync} = require('./lib/stream'); +const {mergePromise, getSpawnedPromise} = require('./lib/promise'); +const {joinCommand, parseCommand, getEscapedCommand} = require('./lib/command'); const DEFAULT_MAX_BUFFER = 1000 * 1000 * 100; @@ -74,6 +74,9 @@ const execa = (file, args, options) => { const parsed = handleArguments(file, args, options); const command = joinCommand(file, args); + const escapedCommand = getEscapedCommand(file, args); + + validateTimeout(parsed.options); let spawned; try { @@ -87,6 +90,7 @@ stderr: '', all: '', command, + escapedCommand, parsed, timedOut: false, isCanceled: false, @@ -119,6 +123,7 @@ stderr, all, command, + escapedCommand, parsed, timedOut, isCanceled: context.isCanceled, @@ -134,6 +139,7 @@ return { command, + escapedCommand, exitCode: 0, stdout, stderr, @@ -147,8 +153,6 @@ const handlePromiseOnce = onetime(handlePromise); - crossSpawn._enoent.hookChildProcess(spawned, parsed.parsed); - handleInput(spawned, parsed.options.input); spawned.all = makeAllStream(spawned, parsed.options); @@ -161,6 +165,7 @@ module.exports.sync = (file, args, options) => { const parsed = handleArguments(file, args, options); const command = joinCommand(file, args); + const escapedCommand = getEscapedCommand(file, args); validateInputSync(parsed.options); @@ -174,6 +179,7 @@ stderr: '', all: '', command, + escapedCommand, parsed, timedOut: false, isCanceled: false, @@ -192,6 +198,7 @@ signal: result.signal, exitCode: result.status, command, + escapedCommand, parsed, timedOut: result.error && result.error.code === 'ETIMEDOUT', isCanceled: false, @@ -207,6 +214,7 @@ return { command, + escapedCommand, exitCode: 0, stdout, stderr, diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/index.test-d.ts node-execa-5.1.1+repack+~cs17.3.6/index.test-d.ts --- node-execa-4.1.0+dfsg+~cs19.3.6/index.test-d.ts 2020-10-28 11:29:04.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/index.test-d.ts 2021-06-04 16:34:39.000000000 +0000 @@ -1,5 +1,5 @@ import {expectType, expectError} from 'tsd'; -import {Readable as ReadableStream} from 'stream' +import {Readable as ReadableStream} from 'stream'; import execa = require('.'); import { ExecaReturnValue, @@ -12,10 +12,11 @@ try { const execaPromise = execa('unicorns'); execaPromise.cancel(); - expectType(execaPromise.all) + expectType(execaPromise.all); const unicornsResult = await execaPromise; expectType(unicornsResult.command); + expectType(unicornsResult.escapedCommand); expectType(unicornsResult.exitCode); expectType(unicornsResult.stdout); expectType(unicornsResult.stderr); @@ -26,7 +27,7 @@ expectType(unicornsResult.killed); expectType(unicornsResult.signal); expectType(unicornsResult.signalDescription); -} catch (error) { +} catch (error) { // eslint-disable-line @typescript-eslint/no-implicit-any-catch const execaError: ExecaError = error; expectType(execaError.message); @@ -47,6 +48,7 @@ try { const unicornsResult = execa.sync('unicorns'); expectType(unicornsResult.command); + expectType(unicornsResult.escapedCommand); expectType(unicornsResult.exitCode); expectType(unicornsResult.stdout); expectType(unicornsResult.stderr); @@ -57,7 +59,7 @@ expectType(unicornsResult.killed); expectType(unicornsResult.signal); expectType(unicornsResult.signalDescription); -} catch (error) { +} catch (error) { // eslint-disable-line @typescript-eslint/no-implicit-any-catch const execaError: ExecaSyncError = error; expectType(execaError.message); diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/lib/command.js node-execa-5.1.1+repack+~cs17.3.6/lib/command.js --- node-execa-4.1.0+dfsg+~cs19.3.6/lib/command.js 2020-10-28 11:29:04.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/lib/command.js 2021-06-04 16:34:39.000000000 +0000 @@ -1,14 +1,33 @@ 'use strict'; -const SPACES_REGEXP = / +/g; - -const joinCommand = (file, args = []) => { +const normalizeArgs = (file, args = []) => { if (!Array.isArray(args)) { - return file; + return [file]; + } + + return [file, ...args]; +}; + +const NO_ESCAPE_REGEXP = /^[\w.-]+$/; +const DOUBLE_QUOTES_REGEXP = /"/g; + +const escapeArg = arg => { + if (typeof arg !== 'string' || NO_ESCAPE_REGEXP.test(arg)) { + return arg; } - return [file, ...args].join(' '); + return `"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\"')}"`; }; +const joinCommand = (file, args) => { + return normalizeArgs(file, args).join(' '); +}; + +const getEscapedCommand = (file, args) => { + return normalizeArgs(file, args).map(arg => escapeArg(arg)).join(' '); +}; + +const SPACES_REGEXP = / +/g; + // Handle `execa.command()` const parseCommand = command => { const tokens = []; @@ -28,5 +47,6 @@ module.exports = { joinCommand, + getEscapedCommand, parseCommand }; diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/lib/error.js node-execa-5.1.1+repack+~cs17.3.6/lib/error.js --- node-execa-4.1.0+dfsg+~cs19.3.6/lib/error.js 2020-10-28 11:29:04.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/lib/error.js 2021-06-04 16:34:39.000000000 +0000 @@ -33,6 +33,7 @@ signal, exitCode, command, + escapedCommand, timedOut, isCanceled, killed, @@ -61,6 +62,7 @@ error.shortMessage = shortMessage; error.command = command; + error.escapedCommand = escapedCommand; error.exitCode = exitCode; error.signal = signal; error.signalDescription = signalDescription; diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/lib/kill.js node-execa-5.1.1+repack+~cs17.3.6/lib/kill.js --- node-execa-4.1.0+dfsg+~cs19.3.6/lib/kill.js 2020-10-28 11:29:04.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/lib/kill.js 2021-06-04 16:34:39.000000000 +0000 @@ -71,10 +71,6 @@ return spawnedPromise; } - if (!Number.isFinite(timeout) || timeout < 0) { - throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`); - } - let timeoutId; const timeoutPromise = new Promise((resolve, reject) => { timeoutId = setTimeout(() => { @@ -89,6 +85,12 @@ return Promise.race([timeoutPromise, safeSpawnedPromise]); }; +const validateTimeout = ({timeout}) => { + if (timeout !== undefined && (!Number.isFinite(timeout) || timeout < 0)) { + throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`); + } +}; + // `cleanup` option handling const setExitHandler = async (spawned, {cleanup, detached}, timedPromise) => { if (!cleanup || detached) { @@ -108,5 +110,6 @@ spawnedKill, spawnedCancel, setupTimeout, + validateTimeout, setExitHandler }; diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/lib/stdio.js node-execa-5.1.1+repack+~cs17.3.6/lib/stdio.js --- node-execa-4.1.0+dfsg+~cs19.3.6/lib/stdio.js 2020-10-28 11:29:04.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/lib/stdio.js 2021-06-04 16:34:39.000000000 +0000 @@ -1,20 +1,20 @@ 'use strict'; const aliases = ['stdin', 'stdout', 'stderr']; -const hasAlias = opts => aliases.some(alias => opts[alias] !== undefined); +const hasAlias = options => aliases.some(alias => options[alias] !== undefined); -const normalizeStdio = opts => { - if (!opts) { +const normalizeStdio = options => { + if (!options) { return; } - const {stdio} = opts; + const {stdio} = options; if (stdio === undefined) { - return aliases.map(alias => opts[alias]); + return aliases.map(alias => options[alias]); } - if (hasAlias(opts)) { + if (hasAlias(options)) { throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map(alias => `\`${alias}\``).join(', ')}`); } @@ -33,8 +33,8 @@ module.exports = normalizeStdio; // `ipc` is pushed unless it is already present -module.exports.node = opts => { - const stdio = normalizeStdio(opts); +module.exports.node = options => { + const stdio = normalizeStdio(options); if (stdio === 'ipc') { return 'ipc'; diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/lib/stream.js node-execa-5.1.1+repack+~cs17.3.6/lib/stream.js --- node-execa-4.1.0+dfsg+~cs19.3.6/lib/stream.js 2020-10-28 11:29:04.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/lib/stream.js 2021-06-04 16:34:39.000000000 +0000 @@ -6,7 +6,7 @@ // `input` option const handleInput = (spawned, input) => { // Checking for stdin is workaround for https://github.com/nodejs/node/issues/26852 - // TODO: Remove `|| spawned.stdin === undefined` once we drop support for Node.js <=12.2.0 + // @todo remove `|| spawned.stdin === undefined` once we drop support for Node.js <=12.2.0 if (input === undefined || spawned.stdin === undefined) { return; } diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/package.json node-execa-5.1.1+repack+~cs17.3.6/package.json --- node-execa-4.1.0+dfsg+~cs19.3.6/package.json 2020-10-28 11:29:04.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/package.json 2021-06-04 16:34:39.000000000 +0000 @@ -1,6 +1,6 @@ { "name": "execa", - "version": "4.1.0", + "version": "5.1.1", "description": "Process execution for humans", "license": "MIT", "repository": "sindresorhus/execa", @@ -39,29 +39,32 @@ "local" ], "dependencies": { - "cross-spawn": "^7.0.0", - "get-stream": "^5.0.0", - "human-signals": "^1.1.1", + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", "is-stream": "^2.0.0", "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.0", - "onetime": "^5.1.0", - "signal-exit": "^3.0.2", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", "strip-final-newline": "^2.0.0" }, "devDependencies": { - "@types/node": "^12.12.18", - "ava": "^2.1.0", - "coveralls": "^3.0.9", - "get-node": "^6.6.0", + "@types/node": "^14.14.10", + "ava": "^2.4.0", + "get-node": "^11.0.1", "is-running": "^2.1.0", - "nyc": "^14.1.1", - "p-event": "^4.1.0", + "nyc": "^15.1.0", + "p-event": "^4.2.0", "tempfile": "^3.0.0", - "tsd": "^0.11.0", - "xo": "^0.25.3" + "tsd": "^0.13.1", + "xo": "^0.35.0" }, "nyc": { + "reporter": [ + "text", + "lcov" + ], "exclude": [ "**/fixtures/**", "**/test.js", diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/readme.md node-execa-5.1.1+repack+~cs17.3.6/readme.md --- node-execa-4.1.0+dfsg+~cs19.3.6/readme.md 2020-10-28 11:29:04.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/readme.md 2021-06-04 16:34:39.000000000 +0000 @@ -1,16 +1,10 @@
-[![Build Status](https://travis-ci.com/sindresorhus/execa.svg?branch=master)](https://travis-ci.com/github/sindresorhus/execa) [![Coverage Status](https://coveralls.io/repos/github/sindresorhus/execa/badge.svg?branch=master)](https://coveralls.io/github/sindresorhus/execa?branch=master) +[![Coverage Status](https://codecov.io/gh/sindresorhus/execa/branch/main/graph/badge.svg)](https://codecov.io/gh/sindresorhus/execa) > Process execution for humans ---- - -Netlify is looking for a senior/expert Node.js backend engineer to join a fully remote, international, diverse (44% women and non-binary) and friendly team. This is for the team where one of the co-maintainers [@ehmicky](https://github.com/ehmicky) is working. The job description is [here](https://boards.greenhouse.io/netlify/jobs/4832483002). - ---- - ## Why This package improves [`child_process`](https://nodejs.org/api/child_process.html) methods with: @@ -74,6 +68,7 @@ originalMessage: 'spawn unknown ENOENT', shortMessage: 'Command failed with ENOENT: unknown command spawn unknown ENOENT', command: 'unknown command', + escapedCommand: 'unknown command', stdout: '', stderr: '', all: '', @@ -127,6 +122,7 @@ originalMessage: 'spawnSync unknown ENOENT', shortMessage: 'Command failed with ENOENT: unknown command spawnSync unknown ENOENT', command: 'unknown command', + escapedCommand: 'unknown command', stdout: '', stderr: '', all: '', @@ -206,7 +202,7 @@ If the file or an argument contains spaces, they must be escaped with backslashes. This matters especially if `command` is not a constant but a variable, for example with `__dirname` or `process.cwd()`. Except for spaces, no escaping/quoting is needed. -The [`shell` option](#shell) must be used if the `command` uses shell-specific features, as opposed to being a simple `file` followed by its `arguments`. +The [`shell` option](#shell) must be used if the `command` uses shell-specific features (for example, `&&` or `||`), as opposed to being a simple `file` followed by its `arguments`. ### execa.commandSync(command, options?) @@ -240,7 +236,18 @@ Type: `string` -The file and arguments that were run. +The file and arguments that were run, for logging purposes. + +This is not escaped and should not be executed directly as a process, including using [`execa()`](#execafile-arguments-options) or [`execa.command()`](#execacommandcommand-options). + +#### escapedCommand + +Type: `string` + +Same as [`command`](#command) but escaped. + +This is meant to be copy and pasted into a shell, for debugging purposes. +Since the escaping is fairly basic, this should not be executed directly as a process, including using [`execa()`](#execafile-arguments-options) or [`execa.command()`](#execacommandcommand-options). #### exitCode diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/strip-final-newline/.editorconfig node-execa-5.1.1+repack+~cs17.3.6/strip-final-newline/.editorconfig --- node-execa-4.1.0+dfsg+~cs19.3.6/strip-final-newline/.editorconfig 2018-10-28 08:36:10.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/strip-final-newline/.editorconfig 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -root = true - -[*] -indent_style = tab -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.yml] -indent_style = space -indent_size = 2 diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/strip-final-newline/.gitattributes node-execa-5.1.1+repack+~cs17.3.6/strip-final-newline/.gitattributes --- node-execa-4.1.0+dfsg+~cs19.3.6/strip-final-newline/.gitattributes 2018-10-28 08:36:10.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/strip-final-newline/.gitattributes 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -* text=auto eol=lf diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/strip-final-newline/.gitignore node-execa-5.1.1+repack+~cs17.3.6/strip-final-newline/.gitignore --- node-execa-4.1.0+dfsg+~cs19.3.6/strip-final-newline/.gitignore 2018-10-28 08:36:10.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/strip-final-newline/.gitignore 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -node_modules -yarn.lock diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/strip-final-newline/index.js node-execa-5.1.1+repack+~cs17.3.6/strip-final-newline/index.js --- node-execa-4.1.0+dfsg+~cs19.3.6/strip-final-newline/index.js 2018-10-28 08:36:10.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/strip-final-newline/index.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -'use strict'; - -module.exports = input => { - const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt(); - const CR = typeof input === 'string' ? '\r' : '\r'.charCodeAt(); - - if (input[input.length - 1] === LF) { - input = input.slice(0, input.length - 1); - } - - if (input[input.length - 1] === CR) { - input = input.slice(0, input.length - 1); - } - - return input; -}; diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/strip-final-newline/license node-execa-5.1.1+repack+~cs17.3.6/strip-final-newline/license --- node-execa-4.1.0+dfsg+~cs19.3.6/strip-final-newline/license 2018-10-28 08:36:10.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/strip-final-newline/license 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/strip-final-newline/.npmrc node-execa-5.1.1+repack+~cs17.3.6/strip-final-newline/.npmrc --- node-execa-4.1.0+dfsg+~cs19.3.6/strip-final-newline/.npmrc 2018-10-28 08:36:10.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/strip-final-newline/.npmrc 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -package-lock=false diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/strip-final-newline/package.json node-execa-5.1.1+repack+~cs17.3.6/strip-final-newline/package.json --- node-execa-4.1.0+dfsg+~cs19.3.6/strip-final-newline/package.json 2018-10-28 08:36:10.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/strip-final-newline/package.json 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -{ - "name": "strip-final-newline", - "version": "2.0.0", - "description": "Strip the final newline character from a string/buffer", - "license": "MIT", - "repository": "sindresorhus/strip-final-newline", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=6" - }, - "scripts": { - "test": "xo && ava" - }, - "files": [ - "index.js" - ], - "keywords": [ - "strip", - "trim", - "remove", - "delete", - "final", - "last", - "end", - "file", - "newline", - "linebreak", - "character", - "string", - "buffer" - ], - "devDependencies": { - "ava": "^0.25.0", - "xo": "^0.23.0" - } -} diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/strip-final-newline/readme.md node-execa-5.1.1+repack+~cs17.3.6/strip-final-newline/readme.md --- node-execa-4.1.0+dfsg+~cs19.3.6/strip-final-newline/readme.md 2018-10-28 08:36:10.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/strip-final-newline/readme.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -# strip-final-newline [![Build Status](https://travis-ci.com/sindresorhus/strip-final-newline.svg?branch=master)](https://travis-ci.com/sindresorhus/strip-final-newline) - -> Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from a string/buffer - -Can be useful when parsing the output of, for example, `ChildProcess#execFile`, as [binaries usually output a newline at the end](https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline). Normally, you would use `stdout.trim()`, but that would also remove newlines at the start and whitespace. - - -## Install - -``` -$ npm install strip-final-newline -``` - - -## Usage - -```js -const stripFinalNewline = require('strip-final-newline'); - -stripFinalNewline('foo\nbar\n\n'); -//=> 'foo\nbar\n' - -stripFinalNewline(Buffer.from('foo\nbar\n\n')).toString(); -//=> 'foo\nbar\n' -``` - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/strip-final-newline/test.js node-execa-5.1.1+repack+~cs17.3.6/strip-final-newline/test.js --- node-execa-4.1.0+dfsg+~cs19.3.6/strip-final-newline/test.js 2018-10-28 08:36:10.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/strip-final-newline/test.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -import test from 'ava'; -import stripFinalNewline from '.'; - -test('string', t => { - t.is(stripFinalNewline('foo\n'), 'foo'); - t.is(stripFinalNewline('foo\nbar\n'), 'foo\nbar'); - t.is(stripFinalNewline('foo\n\n\n'), 'foo\n\n'); - t.is(stripFinalNewline('foo\r\n'), 'foo'); - t.is(stripFinalNewline('foo\r'), 'foo'); - t.is(stripFinalNewline('foo\n\r\n'), 'foo\n'); -}); - -test('buffer', t => { - t.is(stripFinalNewline(Buffer.from('foo\n')).toString(), 'foo'); - t.is(stripFinalNewline(Buffer.from('foo\nbar\n')).toString(), 'foo\nbar'); - t.is(stripFinalNewline(Buffer.from('foo\n\n\n').toString()), 'foo\n\n'); - t.is(stripFinalNewline(Buffer.from('foo\r\n')).toString(), 'foo'); - t.is(stripFinalNewline(Buffer.from('foo\r')).toString(), 'foo'); - t.is(stripFinalNewline(Buffer.from('foo\n\r\n')).toString(), 'foo\n'); -}); diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/strip-final-newline/.travis.yml node-execa-5.1.1+repack+~cs17.3.6/strip-final-newline/.travis.yml --- node-execa-4.1.0+dfsg+~cs19.3.6/strip-final-newline/.travis.yml 2018-10-28 08:36:10.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/strip-final-newline/.travis.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -language: node_js -node_js: - - '10' - - '8' - - '6' diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/test/command.js node-execa-5.1.1+repack+~cs17.3.6/test/command.js --- node-execa-4.1.0+dfsg+~cs19.3.6/test/command.js 2020-10-28 11:29:04.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/test/command.js 2021-06-04 16:34:39.000000000 +0000 @@ -18,6 +18,29 @@ test(command, ' baz quz', 'baz', 'quz'); test(command, ''); +const testEscapedCommand = async (t, expected, args) => { + const {escapedCommand: failEscapedCommand} = await t.throwsAsync(execa('fail', args)); + t.is(failEscapedCommand, `fail ${expected}`); + + const {escapedCommand: failEscapedCommandSync} = t.throws(() => { + execa.sync('fail', args); + }); + t.is(failEscapedCommandSync, `fail ${expected}`); + + const {escapedCommand} = await execa('noop', args); + t.is(escapedCommand, `noop ${expected}`); + + const {escapedCommand: escapedCommandSync} = execa.sync('noop', args); + t.is(escapedCommandSync, `noop ${expected}`); +}; + +testEscapedCommand.title = (message, expected) => `escapedCommand is: ${JSON.stringify(expected)}`; + +test(testEscapedCommand, 'foo bar', ['foo', 'bar']); +test(testEscapedCommand, '"foo bar"', ['foo bar']); +test(testEscapedCommand, '"\\"foo\\""', ['"foo"']); +test(testEscapedCommand, '"*"', ['*']); + test('allow commands with spaces and no array arguments', async t => { const {stdout} = await execa('command with space'); t.is(stdout, ''); diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/test/error.js node-execa-5.1.1+repack+~cs17.3.6/test/error.js --- node-execa-4.1.0+dfsg+~cs19.3.6/test/error.js 2020-10-28 11:29:04.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/test/error.js 2021-06-04 16:34:39.000000000 +0000 @@ -41,9 +41,9 @@ t.is(exitCode, 0); }); -const testExitCode = async (t, num) => { - const {exitCode} = await t.throwsAsync(execa('exit', [`${num}`]), {message: getExitRegExp(num)}); - t.is(exitCode, num); +const testExitCode = async (t, number) => { + const {exitCode} = await t.throwsAsync(execa('exit', [`${number}`]), {message: getExitRegExp(number)}); + t.is(exitCode, number); }; test('exitCode is 2', testExitCode, 2); @@ -73,8 +73,8 @@ }); test('Original error.message is kept', async t => { - const {originalMessage} = await t.throwsAsync(execa('wrong command')); - t.is(originalMessage, 'spawn wrong command ENOENT'); + const {originalMessage} = await t.throwsAsync(execa('noop', {cwd: 1})); + t.true(originalMessage.startsWith('The "options.cwd" property must be of type string. Received type number')); }); test('failed is false on success', async t => { @@ -205,6 +205,6 @@ }); test('error.code is defined on failure if applicable', async t => { - const {code} = await t.throwsAsync(execa('invalid')); - t.is(code, 'ENOENT'); + const {code} = await t.throwsAsync(execa('noop', {cwd: 1})); + t.is(code, 'ERR_INVALID_ARG_TYPE'); }); diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/test/fixtures/detach node-execa-5.1.1+repack+~cs17.3.6/test/fixtures/detach --- node-execa-4.1.0+dfsg+~cs19.3.6/test/fixtures/detach 2020-10-28 11:29:04.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/test/fixtures/detach 2021-06-04 16:34:39.000000000 +0000 @@ -3,6 +3,6 @@ const execa = require('../..'); -const subprocess = execa('node', ['./test/fixtures/noop'], {detached: true}); +const subprocess = execa('node', ['./test/fixtures/forever'], {detached: true}); console.log(subprocess.pid); process.exit(); diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/test/kill.js node-execa-5.1.1+repack+~cs17.3.6/test/kill.js --- node-execa-4.1.0+dfsg+~cs19.3.6/test/kill.js 2020-10-28 11:29:04.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/test/kill.js 2021-06-04 16:34:39.000000000 +0000 @@ -63,7 +63,7 @@ test('`forceKillAfterTimeout` should not be NaN', t => { t.throws(() => { - execa('noop').kill('SIGTERM', {forceKillAfterTimeout: NaN}); + execa('noop').kill('SIGTERM', {forceKillAfterTimeout: Number.NaN}); }, {instanceOf: TypeError, message: /non-negative integer/}); }); @@ -138,7 +138,7 @@ test('spawnAndExit cleanup detached', spawnAndExit, true, true); // When parent process exits before child process -const spawnAndKill = async (t, signal, cleanup, detached, isKilled) => { +const spawnAndKill = async (t, [signal, cleanup, detached, isKilled]) => { const subprocess = execa('sub-process', [cleanup, detached], {stdio: ['ignore', 'ignore', 'ignore', 'ipc']}); const pid = await pEvent(subprocess, 'message'); @@ -164,18 +164,18 @@ // With `options.cleanup`, subprocesses are always killed // - `options.cleanup` with SIGKILL is a noop, since it cannot be handled const exitIfWindows = process.platform === 'win32'; -test('spawnAndKill SIGTERM', spawnAndKill, 'SIGTERM', false, false, exitIfWindows); -test('spawnAndKill SIGKILL', spawnAndKill, 'SIGKILL', false, false, exitIfWindows); -test('spawnAndKill cleanup SIGTERM', spawnAndKill, 'SIGTERM', true, false, true); -test('spawnAndKill cleanup SIGKILL', spawnAndKill, 'SIGKILL', true, false, exitIfWindows); -test('spawnAndKill detached SIGTERM', spawnAndKill, 'SIGTERM', false, true, false); -test('spawnAndKill detached SIGKILL', spawnAndKill, 'SIGKILL', false, true, false); -test('spawnAndKill cleanup detached SIGTERM', spawnAndKill, 'SIGTERM', true, true, false); -test('spawnAndKill cleanup detached SIGKILL', spawnAndKill, 'SIGKILL', true, true, false); +test('spawnAndKill SIGTERM', spawnAndKill, ['SIGTERM', false, false, exitIfWindows]); +test('spawnAndKill SIGKILL', spawnAndKill, ['SIGKILL', false, false, exitIfWindows]); +test('spawnAndKill cleanup SIGTERM', spawnAndKill, ['SIGTERM', true, false, true]); +test('spawnAndKill cleanup SIGKILL', spawnAndKill, ['SIGKILL', true, false, exitIfWindows]); +test('spawnAndKill detached SIGTERM', spawnAndKill, ['SIGTERM', false, true, false]); +test('spawnAndKill detached SIGKILL', spawnAndKill, ['SIGKILL', false, true, false]); +test('spawnAndKill cleanup detached SIGTERM', spawnAndKill, ['SIGTERM', true, true, false]); +test('spawnAndKill cleanup detached SIGKILL', spawnAndKill, ['SIGKILL', true, true, false]); // See #128 test('removes exit handler on exit', async t => { - // FIXME: This relies on `signal-exit` internals + // @todo this relies on `signal-exit` internals const emitter = process.__signal_exit_emitter__; const subprocess = execa('noop'); diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/test/stdio.js node-execa-5.1.1+repack+~cs17.3.6/test/stdio.js --- node-execa-4.1.0+dfsg+~cs19.3.6/test/stdio.js 2020-10-28 11:29:04.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/test/stdio.js 2021-06-04 16:34:39.000000000 +0000 @@ -1,4 +1,4 @@ -import util from 'util'; +import {inspect} from 'util'; import test from 'ava'; import normalizeStdio from '../lib/stdio'; @@ -13,7 +13,7 @@ t.deepEqual(func(input), expected); }; -const macroTitle = name => (title, input) => `${name} ${(util.inspect(input))}`; +const macroTitle = name => (title, input) => `${name} ${(inspect(input))}`; const stdioMacro = (...args) => macro(...args, normalizeStdio); stdioMacro.title = macroTitle('execa()'); diff -Nru node-execa-4.1.0+dfsg+~cs19.3.6/.travis.yml node-execa-5.1.1+repack+~cs17.3.6/.travis.yml --- node-execa-4.1.0+dfsg+~cs19.3.6/.travis.yml 2020-10-28 11:29:04.000000000 +0000 +++ node-execa-5.1.1+repack+~cs17.3.6/.travis.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -os: - - linux - - osx -language: node_js -node_js: - - '15' - - '14' - - '12' - - '10' -after_success: - - './node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls'