cross-spawn-cb 2.1.20 → 2.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/assets/cross-spawn.cjs
CHANGED
|
@@ -26,7 +26,6 @@ var pathDelimiter = process.platform === 'win32' ? ';' : ':';
|
|
|
26
26
|
var cpSpawnSync = require('child_process').spawnSync || require('../dist/cjs/lib/spawnSyncPolyfill.cjs');
|
|
27
27
|
|
|
28
28
|
/* COMPATIBILITY POLYFILLS */
|
|
29
|
-
|
|
30
29
|
var require$$0$2 = require('child_process');
|
|
31
30
|
var require$$0$1 = require('path');
|
|
32
31
|
var require$$0 = require('fs');
|
|
@@ -318,7 +317,7 @@ function requirePathKey() {
|
|
|
318
317
|
if (platform !== 'win32') {
|
|
319
318
|
return 'PATH';
|
|
320
319
|
}
|
|
321
|
-
return findKey(env,function(x) {
|
|
320
|
+
return findKey(env, function(x) {
|
|
322
321
|
return x.toUpperCase() === 'PATH';
|
|
323
322
|
}) || 'Path';
|
|
324
323
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/workers/async.ts"],"sourcesContent":["import oo from 'on-one';\nimport { spawnKeys } from '../constants';\n\nimport type { ChildProcess, SpawnCallback, SpawnError, SpawnOptions, SpawnResult } from '../types';\n\nfunction isError(obj) {\n return Object.prototype.toString.call(obj) === '[object Error]';\n}\n\nexport default function worker(cp: ChildProcess, options?: SpawnOptions | SpawnCallback, callback?: SpawnCallback) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n\n // collect output\n const res = { pid: 0, output: [], stdout: null, stderr: null, status: null, signal: null } as SpawnResult;\n const stdout: Buffer[] = [];\n const stderr: Buffer[] = [];\n if (options.encoding && cp.stdout) cp.stdout.on('data', stdout.push.bind(stdout));\n if (options.encoding && cp.stderr) cp.stderr.on('data', stderr.push.bind(stderr));\n\n // some versions of node emit both an error and close\n oo(cp, ['error', 'close'], (status, signal) => {\n if (isError(status)) {\n const err = status as SpawnError;\n if (err.code === 'OK') return; // ignore\n return callback(err);\n }\n\n // prepare result\n res.pid = cp.pid;\n res.status = status;\n res.signal = signal;\n if (options.encoding && cp.stdout) {\n res.stdout = Buffer.concat(stdout);\n if (options.encoding !== 'binary') res.stdout = res.stdout.toString(options.encoding);\n }\n if (options.encoding && cp.stderr) {\n res.stderr = Buffer.concat(stderr);\n if (options.encoding !== 'binary') res.stderr = res.stderr.toString(options.encoding);\n }\n res.output = [null, res.stdout, res.stderr];\n if (res.status === null) res.status = 0; // patch: early node on windows could return null\n\n // process errors\n const err = res.status !== 0 ? new Error(`Non-zero exit code: ${res.status}`) : null;\n if (err) {\n for (const key in res) {\n if (spawnKeys.indexOf(key) < 0) continue;\n err[key] = Buffer.isBuffer(res[key]) ? res[key].toString(options.encoding || 'utf8') : res[key];\n }\n }\n err ? callback(err) : callback(null, res);\n });\n\n // pipe input\n if (options.input && (typeof options.input === 'string' || Buffer.isBuffer(options.input))) {\n cp.stdin.end(options.input);\n }\n}\n"],"names":["worker","isError","obj","Object","prototype","toString","call","cp","options","callback","res","pid","output","stdout","stderr","status","signal","encoding","on","push","bind","oo","err","code","Buffer","concat","Error","key","spawnKeys","indexOf","isBuffer","input","stdin","end"],"mappings":";;;;+BASA;;;eAAwBA;;;4DATT;yBACW;;;;;;AAI1B,SAASC,QAAQC,GAAG;IAClB,OAAOC,OAAOC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACJ,SAAS;AACjD;AAEe,SAASF,OAAOO,EAAgB,EAAEC,OAAsC,EAAEC,QAAwB;IAC/G,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU,CAAC;IACb;IACAA,UAAUA,WAAW,CAAC;IAEtB,iBAAiB;IACjB,IAAME,MAAM;QAAEC,KAAK;QAAGC,QAAQ,EAAE;QAAEC,QAAQ;QAAMC,QAAQ;QAAMC,QAAQ;QAAMC,QAAQ;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B;QACjB,IAAMO,OAAMZ,IAAIK,MAAM,KAAK,IAAI,IAAIW,MAAM,AAAC,uBAAiC,OAAXhB,IAAIK,MAAM,KAAM;QAChF,IAAIO,MAAK;YACP,IAAK,IAAMK,OAAOjB,IAAK;gBACrB,IAAIkB,oBAAS,CAACC,OAAO,CAACF,OAAO,GAAG;gBAChCL,IAAG,CAACK,IAAI,GAAGH,OAAOM,QAAQ,CAACpB,GAAG,CAACiB,IAAI,IAAIjB,GAAG,CAACiB,IAAI,CAACtB,QAAQ,CAACG,QAAQS,QAAQ,IAAI,UAAUP,GAAG,CAACiB,IAAI;YACjG;QACF;QACAL,OAAMb,SAASa,
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/workers/async.ts"],"sourcesContent":["import oo from 'on-one';\nimport { spawnKeys } from '../constants';\n\nimport type { ChildProcess, SpawnCallback, SpawnError, SpawnOptions, SpawnResult } from '../types';\n\nfunction isError(obj) {\n return Object.prototype.toString.call(obj) === '[object Error]';\n}\n\nexport default function worker(cp: ChildProcess, options?: SpawnOptions | SpawnCallback, callback?: SpawnCallback) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n\n // collect output\n const res = { pid: 0, output: [], stdout: null, stderr: null, status: null, signal: null } as SpawnResult;\n const stdout: Buffer[] = [];\n const stderr: Buffer[] = [];\n if (options.encoding && cp.stdout) cp.stdout.on('data', stdout.push.bind(stdout));\n if (options.encoding && cp.stderr) cp.stderr.on('data', stderr.push.bind(stderr));\n\n // some versions of node emit both an error and close\n oo(cp, ['error', 'close'], (status, signal) => {\n if (isError(status)) {\n const err = status as SpawnError;\n if (err.code === 'OK') return; // ignore\n return callback(err);\n }\n\n // prepare result\n res.pid = cp.pid;\n res.status = status;\n res.signal = signal;\n if (options.encoding && cp.stdout) {\n res.stdout = Buffer.concat(stdout);\n if (options.encoding !== 'binary') res.stdout = res.stdout.toString(options.encoding);\n }\n if (options.encoding && cp.stderr) {\n res.stderr = Buffer.concat(stderr);\n if (options.encoding !== 'binary') res.stderr = res.stderr.toString(options.encoding);\n }\n res.output = [null, res.stdout, res.stderr];\n if (res.status === null) res.status = 0; // patch: early node on windows could return null\n\n // process errors\n const err = res.status !== 0 ? new Error(`Non-zero exit code: ${res.status}`) : null;\n if (err) {\n for (const key in res) {\n if (spawnKeys.indexOf(key) < 0) continue;\n err[key] = Buffer.isBuffer(res[key]) ? res[key].toString(options.encoding || 'utf8') : res[key];\n }\n }\n err ? callback(err as SpawnError) : callback(null, res);\n });\n\n // pipe input\n if (options.input && (typeof options.input === 'string' || Buffer.isBuffer(options.input))) {\n cp.stdin.end(options.input);\n }\n}\n"],"names":["worker","isError","obj","Object","prototype","toString","call","cp","options","callback","res","pid","output","stdout","stderr","status","signal","encoding","on","push","bind","oo","err","code","Buffer","concat","Error","key","spawnKeys","indexOf","isBuffer","input","stdin","end"],"mappings":";;;;+BASA;;;eAAwBA;;;4DATT;yBACW;;;;;;AAI1B,SAASC,QAAQC,GAAG;IAClB,OAAOC,OAAOC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACJ,SAAS;AACjD;AAEe,SAASF,OAAOO,EAAgB,EAAEC,OAAsC,EAAEC,QAAwB;IAC/G,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU,CAAC;IACb;IACAA,UAAUA,WAAW,CAAC;IAEtB,iBAAiB;IACjB,IAAME,MAAM;QAAEC,KAAK;QAAGC,QAAQ,EAAE;QAAEC,QAAQ;QAAMC,QAAQ;QAAMC,QAAQ;QAAMC,QAAQ;IAAK;IACzF,IAAMH,SAAmB,EAAE;IAC3B,IAAMC,SAAmB,EAAE;IAC3B,IAAIN,QAAQS,QAAQ,IAAIV,GAAGM,MAAM,EAAEN,GAAGM,MAAM,CAACK,EAAE,CAAC,QAAQL,OAAOM,IAAI,CAACC,IAAI,CAACP;IACzE,IAAIL,QAAQS,QAAQ,IAAIV,GAAGO,MAAM,EAAEP,GAAGO,MAA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AQ,CAACpB,GAAG,CAACiB,IAAI,IAAIjB,GAAG,CAACiB,IAAI,CAACtB,QAAQ,CAACG,QAAQS,QAAQ,IAAI,UAAUP,GAAG,CAACiB,IAAI;YACjG;QACF;QACAL,OAAMb,SAASa,QAAqBb,SAAS,MAAMC;IACrD;IAEA,aAAa;IACb,IAAIF,QAAQuB,KAAK,IAAK,CAAA,OAAOvB,QAAQuB,KAAK,KAAK,YAAYP,OAAOM,QAAQ,CAACtB,QAAQuB,KAAK,CAAA,GAAI;QAC1FxB,GAAGyB,KAAK,CAACC,GAAG,CAACzB,QAAQuB,KAAK;IAC5B;AACF"}
|
package/dist/esm/types.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/types.ts"],"sourcesContent":["import type * as child_process from 'child_process';\n\nexport type ChildProcess = child_process.ChildProcess;\nexport interface SpawnOptions extends child_process.SpawnOptions {\n encoding?: BufferEncoding;\n env?: NodeJS.ProcessEnv;\n input?: string | Buffer;\n}\nexport type SpawnResult = child_process.SpawnSyncReturns<string | Buffer>;\n\nexport interface SpawnError extends Error {\n
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/types.ts"],"sourcesContent":["import type * as child_process from 'child_process';\n\nexport type ChildProcess = child_process.ChildProcess;\nexport interface SpawnOptions extends child_process.SpawnOptions {\n encoding?: BufferEncoding;\n env?: NodeJS.ProcessEnv;\n input?: string | Buffer;\n}\nexport type SpawnResult = child_process.SpawnSyncReturns<string | Buffer>;\n\nexport interface SpawnError extends Error, SpawnResult {\n code?: string;\n}\nexport type SpawnCallback = (err?: SpawnError, res?: SpawnResult) => void;\n"],"names":[],"mappings":"AAaA,WAA0E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/workers/async.ts"],"sourcesContent":["import oo from 'on-one';\nimport { spawnKeys } from '../constants';\n\nimport type { ChildProcess, SpawnCallback, SpawnError, SpawnOptions, SpawnResult } from '../types';\n\nfunction isError(obj) {\n return Object.prototype.toString.call(obj) === '[object Error]';\n}\n\nexport default function worker(cp: ChildProcess, options?: SpawnOptions | SpawnCallback, callback?: SpawnCallback) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n\n // collect output\n const res = { pid: 0, output: [], stdout: null, stderr: null, status: null, signal: null } as SpawnResult;\n const stdout: Buffer[] = [];\n const stderr: Buffer[] = [];\n if (options.encoding && cp.stdout) cp.stdout.on('data', stdout.push.bind(stdout));\n if (options.encoding && cp.stderr) cp.stderr.on('data', stderr.push.bind(stderr));\n\n // some versions of node emit both an error and close\n oo(cp, ['error', 'close'], (status, signal) => {\n if (isError(status)) {\n const err = status as SpawnError;\n if (err.code === 'OK') return; // ignore\n return callback(err);\n }\n\n // prepare result\n res.pid = cp.pid;\n res.status = status;\n res.signal = signal;\n if (options.encoding && cp.stdout) {\n res.stdout = Buffer.concat(stdout);\n if (options.encoding !== 'binary') res.stdout = res.stdout.toString(options.encoding);\n }\n if (options.encoding && cp.stderr) {\n res.stderr = Buffer.concat(stderr);\n if (options.encoding !== 'binary') res.stderr = res.stderr.toString(options.encoding);\n }\n res.output = [null, res.stdout, res.stderr];\n if (res.status === null) res.status = 0; // patch: early node on windows could return null\n\n // process errors\n const err = res.status !== 0 ? new Error(`Non-zero exit code: ${res.status}`) : null;\n if (err) {\n for (const key in res) {\n if (spawnKeys.indexOf(key) < 0) continue;\n err[key] = Buffer.isBuffer(res[key]) ? res[key].toString(options.encoding || 'utf8') : res[key];\n }\n }\n err ? callback(err) : callback(null, res);\n });\n\n // pipe input\n if (options.input && (typeof options.input === 'string' || Buffer.isBuffer(options.input))) {\n cp.stdin.end(options.input);\n }\n}\n"],"names":["oo","spawnKeys","isError","obj","Object","prototype","toString","call","worker","cp","options","callback","res","pid","output","stdout","stderr","status","signal","encoding","on","push","bind","err","code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QAAQ,KAAK,UAAUP,IAAIG,MAAM,GAAGH,IAAIG,MAAM,CAACT,QAAQ,CAACI,QAAQS,QAAQ;QACtF;QACA,IAAIT,QAAQS,QAAQ,IAAIV,GAAGO,MAAM,EAAE;YACjCJ,IAAII,MAAM,GAAGS,OAAOC,MAAM,CAACV;YAC3B,IAAIN,QAAQS,QAAQ,KAAK,UAAUP,IAAII,MAAM,GAAGJ,IAAII,MAAM,CAACV,QAAQ,CAACI,QAAQS,QAAQ;QACtF;QACAP,IAAIE,MAAM,GAAG;YAAC;YAAMF,IAAIG,MAAM;YAAEH,IAAII,MAAM;SAAC;QAC3C,IAAIJ,IAAIK,MAAM,KAAK,MAAML,IAAIK,MAAM,GAAG,GAAG,iDAAiD;QAE1F,iBAAiB;QACjB,MAAMM,MAAMX,IAAIK,MAAM,KAAK,IAAI,IAAIU,MAAM,CAAC,oBAAoB,EAAEf,IAAIK,MAAM,EAAE,IAAI;QAChF,IAAIM,KAAK;YACP,IAAK,MAAMK,OAAOhB,IAAK;gBACrB,IAAIX,UAAU4B,OAAO,CAACD,OAAO,GAAG;gBAChCL,GAAG,CAACK,IAAI,GAAGH,OAAOK,QAAQ,CAAClB,GAAG,CAACgB,IAAI,IAAIhB,GAAG,CAACgB,IAAI,CAACtB,QAAQ,CAACI,QAAQS,QAAQ,IAAI,UAAUP,GAAG,CAACgB,IAAI;YACjG;QACF;QACAL,MAAMZ,SAASY,
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/compat/cross-spawn-cb/src/workers/async.ts"],"sourcesContent":["import oo from 'on-one';\nimport { spawnKeys } from '../constants';\n\nimport type { ChildProcess, SpawnCallback, SpawnError, SpawnOptions, SpawnResult } from '../types';\n\nfunction isError(obj) {\n return Object.prototype.toString.call(obj) === '[object Error]';\n}\n\nexport default function worker(cp: ChildProcess, options?: SpawnOptions | SpawnCallback, callback?: SpawnCallback) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n\n // collect output\n const res = { pid: 0, output: [], stdout: null, stderr: null, status: null, signal: null } as SpawnResult;\n const stdout: Buffer[] = [];\n const stderr: Buffer[] = [];\n if (options.encoding && cp.stdout) cp.stdout.on('data', stdout.push.bind(stdout));\n if (options.encoding && cp.stderr) cp.stderr.on('data', stderr.push.bind(stderr));\n\n // some versions of node emit both an error and close\n oo(cp, ['error', 'close'], (status, signal) => {\n if (isError(status)) {\n const err = status as SpawnError;\n if (err.code === 'OK') return; // ignore\n return callback(err);\n }\n\n // prepare result\n res.pid = cp.pid;\n res.status = status;\n res.signal = signal;\n if (options.encoding && cp.stdout) {\n res.stdout = Buffer.concat(stdout);\n if (options.encoding !== 'binary') res.stdout = res.stdout.toString(options.encoding);\n }\n if (options.encoding && cp.stderr) {\n res.stderr = Buffer.concat(stderr);\n if (options.encoding !== 'binary') res.stderr = res.stderr.toString(options.encoding);\n }\n res.output = [null, res.stdout, res.stderr];\n if (res.status === null) res.status = 0; // patch: early node on windows could return null\n\n // process errors\n const err = res.status !== 0 ? new Error(`Non-zero exit code: ${res.status}`) : null;\n if (err) {\n for (const key in res) {\n if (spawnKeys.indexOf(key) < 0) continue;\n err[key] = Buffer.isBuffer(res[key]) ? res[key].toString(options.encoding || 'utf8') : res[key];\n }\n }\n err ? callback(err as SpawnError) : callback(null, res);\n });\n\n // pipe input\n if (options.input && (typeof options.input === 'string' || Buffer.isBuffer(options.input))) {\n cp.stdin.end(options.input);\n }\n}\n"],"names":["oo","spawnKeys","isError","obj","Object","prototype","toString","call","worker","cp","options","callback","res","pid","output","stdout","stderr","status","signal","encoding","on","push","bind","err","code","Buffer","concat","Error","key","indexOf","isBuffer","input","stdin","end"],"mappings":"AAAA,OAAOA,QAAQ,SAAS;AACxB,SAASC,SAAS,QAAQ,eAAe;AAIzC,SAASC,QAAQC,GAAG;IAClB,OAAOC,OAAOC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACJ,SAAS;AACjD;AAEA,eAAe,SAASK,OAAOC,EAAgB,EAAEC,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AAM,GAAGJ,IAAII,MAAM,CAACV,QAAQ,CAACI,QAAQS,QAAQ;QACtF;QACAP,IAAIE,MAAM,GAAG;YAAC;YAAMF,IAAIG,MAAM;YAAEH,IAAII,MAAM;SAAC;QAC3C,IAAIJ,IAAIK,MAAM,KAAK,MAAML,IAAIK,MAAM,GAAG,GAAG,iDAAiD;QAE1F,iBAAiB;QACjB,MAAMM,MAAMX,IAAIK,MAAM,KAAK,IAAI,IAAIU,MAAM,CAAC,oBAAoB,EAAEf,IAAIK,MAAM,EAAE,IAAI;QAChF,IAAIM,KAAK;YACP,IAAK,MAAMK,OAAOhB,IAAK;gBACrB,IAAIX,UAAU4B,OAAO,CAACD,OAAO,GAAG;gBAChCL,GAAG,CAACK,IAAI,GAAGH,OAAOK,QAAQ,CAAClB,GAAG,CAACgB,IAAI,IAAIhB,GAAG,CAACgB,IAAI,CAACtB,QAAQ,CAACI,QAAQS,QAAQ,IAAI,UAAUP,GAAG,CAACgB,IAAI;YACjG;QACF;QACAL,MAAMZ,SAASY,OAAqBZ,SAAS,MAAMC;IACrD;IAEA,aAAa;IACb,IAAIF,QAAQqB,KAAK,IAAK,CAAA,OAAOrB,QAAQqB,KAAK,KAAK,YAAYN,OAAOK,QAAQ,CAACpB,QAAQqB,KAAK,CAAA,GAAI;QAC1FtB,GAAGuB,KAAK,CAACC,GAAG,CAACvB,QAAQqB,KAAK;IAC5B;AACF"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -6,9 +6,7 @@ export interface SpawnOptions extends child_process.SpawnOptions {
|
|
|
6
6
|
input?: string | Buffer;
|
|
7
7
|
}
|
|
8
8
|
export type SpawnResult = child_process.SpawnSyncReturns<string | Buffer>;
|
|
9
|
-
export interface SpawnError extends Error {
|
|
10
|
-
status?: number;
|
|
11
|
-
stderr?: string | Buffer;
|
|
9
|
+
export interface SpawnError extends Error, SpawnResult {
|
|
12
10
|
code?: string;
|
|
13
11
|
}
|
|
14
12
|
export type SpawnCallback = (err?: SpawnError, res?: SpawnResult) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cross-spawn-cb",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.22",
|
|
4
4
|
"description": "Cross spawn with a completion callback",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cross-spawn",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"cross-spawn": "^7.0.6",
|
|
37
|
-
"function-exec-sync": "^1.2.
|
|
38
|
-
"on-one": "^0.1.
|
|
37
|
+
"function-exec-sync": "^1.2.19",
|
|
38
|
+
"on-one": "^0.1.4"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/mocha": "*",
|