Skip to content
Myr

Minor tweaks

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sindre Sorhus · committed by Sindre Sorhus · parent 7707880 · Browse files · 7 files+29 added−29 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

7 files+29 added−29 removed

  • tests:+2 added−2 removed
  • other:+27 added−27 removed

7 files+29 added−29 removed

modified:.github/workflows/main.yml+3 added-3 removed
modified:test/kill.js+1 added-1 removed
1import path from 'node:path';2import process from 'node:process';3import {fileURLToPath} from 'node:url';4import test from 'ava';5import pEvent from 'p-event';5import {pEvent} from 'p-event';6import isRunning from 'is-running';7import {execa, execaSync} from '../index.js';89process.env.PATH = fileURLToPath(new URL('./fixtures', import.meta.url)) + path.delimiter + process.env.PATH;
255 unmodified lines
modified:test/node.js+1 added-1 removed
modified:index.js+10 added-10 removed
70 unmodified lines
7172 return value;73};7475export const execa = (file, args, options) => {75export function execa(file, args, options) {76 const parsed = handleArguments(file, args, options);77 const command = joinCommand(file, args);78 const escapedCommand = getEscapedCommand(file, args);79
78 unmodified lines
158159 spawned.all = makeAllStream(spawned, parsed.options);160161 return mergePromise(spawned, handlePromiseOnce);162};162}163164export const execaSync = (file, args, options) => {164export function execaSync(file, args, options) {165 const parsed = handleArguments(file, args, options);166 const command = joinCommand(file, args);167 const escapedCommand = getEscapedCommand(file, args);168
52 unmodified lines
221 timedOut: false,222 isCanceled: false,223 killed: false,224 };225};225}226227export const execaCommand = (command, options) => {227export function execaCommand(command, options) {228 const [file, ...args] = parseCommand(command);229 return execa(file, args, options);230};230}231232export const execaCommandSync = (command, options) => {232export function execaCommandSync(command, options) {233 const [file, ...args] = parseCommand(command);234 return execaSync(file, args, options);235};235}236237export const execaNode = (scriptPath, args, options = {}) => {237export function execaNode(scriptPath, args, options = {}) {238 if (args && !Array.isArray(args) && typeof args === 'object') {239 options = args;240 args = [];241 }
21 unmodified lines
263 stdio,264 shell: false,265 },266 );267};267}
modified:index.test-d.ts+4 added-4 removed
34 unmodified lines
35 expectType<boolean>(unicornsResult.isCanceled);36 expectType<boolean>(unicornsResult.killed);37 expectType<string | undefined>(unicornsResult.signal);38 expectType<string | undefined>(unicornsResult.signalDescription);39} catch (error) { // eslint-disable-line @typescript-eslint/no-implicit-any-catch40 const execaError: ExecaError = error;39} catch (error: unknown) {40 const execaError = error as ExecaError;4142 expectType<string>(execaError.message);43 expectType<number>(execaError.exitCode);44 expectType<string>(execaError.stdout);
22 unmodified lines
67 expectError(unicornsResult.isCanceled);68 expectType<boolean>(unicornsResult.killed);69 expectType<string | undefined>(unicornsResult.signal);70 expectType<string | undefined>(unicornsResult.signalDescription);71} catch (error) { // eslint-disable-line @typescript-eslint/no-implicit-any-catch72 const execaError: ExecaSyncError = error;71} catch (error: unknown) {72 const execaError = error as ExecaSyncError;7374 expectType<string>(execaError.message);75 expectType<number>(execaError.exitCode);76 expectType<string>(execaError.stdout);
129 unmodified lines
modified:package.json+8 added-8 removed
8 unmodified lines
9 "name": "Sindre Sorhus",10 "email": "sindresorhus@gmail.com",11 "url": "https://sindresorhus.com"12 },13 "type": "module",14 "exports": "./index.js",15 "engines": {16 "node": "^12.20.0 || ^14.13.1 || >=16.0.0"17 },16 "type": "module",17 "exports": "./index.js",18 "scripts": {19 "test": "xo && c8 ava && tsd"20 },21 "files": [
19 unmodified lines
41 "local"42 ],43 "dependencies": {44 "cross-spawn": "^7.0.3",45 "get-stream": "^6.0.0",45 "get-stream": "^6.0.1",46 "human-signals": "^3.0.1",47 "is-stream": "^3.0.0",48 "merge-stream": "^2.0.0",49 "npm-run-path": "^5.0.1",50 "onetime": "^6.0.0",51 "signal-exit": "^3.0.3",51 "signal-exit": "^3.0.5",52 "strip-final-newline": "^3.0.0"53 },54 "devDependencies": {55 "@types/node": "^16.11.7",56 "ava": "^3.15.0",57 "c8": "^7.10.0",58 "get-node": "^11.0.1",58 "get-node": "^12.0.0",59 "is-running": "^2.1.0",60 "p-event": "^4.2.0",61 "tempfile": "^3.0.0",62 "tsd": "^0.13.1",60 "p-event": "^5.0.1",61 "tempfile": "^4.0.0",62 "tsd": "^0.18.0",63 "xo": "^0.46.4"64 },65 "c8": {66 "reporter": [
10 unmodified lines
modified:readme.md+2 added-2 removed
20 unmodified lines
21- More descriptive errors.2223## Install2425```sh26npm install execa27```26$ npm install execa27```2829## Usage3031```js
623 unmodified lines