cross-spawn-cb 0.6.12 → 0.6.13
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.
|
@@ -1,25 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
-
|
|
5
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
-
|
|
7
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
8
|
-
|
|
9
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
10
|
-
|
|
11
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
12
|
-
|
|
13
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
|
-
|
|
15
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
|
-
|
|
17
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
18
|
-
|
|
19
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
20
|
-
|
|
21
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
22
|
-
|
|
23
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
24
4
|
|
|
25
5
|
Object.defineProperty(exports, '__esModule', {
|
|
@@ -32,6 +12,8 @@ var require$$0$1 = require('path');
|
|
|
32
12
|
|
|
33
13
|
var require$$0 = require('fs');
|
|
34
14
|
|
|
15
|
+
var require$$5 = require('semver');
|
|
16
|
+
|
|
35
17
|
function _interopDefaultLegacy(e) {
|
|
36
18
|
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
|
37
19
|
'default': e
|
|
@@ -44,10 +26,24 @@ var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
|
|
|
44
26
|
|
|
45
27
|
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
|
|
46
28
|
|
|
29
|
+
var require$$5__default = /*#__PURE__*/_interopDefaultLegacy(require$$5);
|
|
30
|
+
|
|
47
31
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
48
32
|
var crossSpawn = {
|
|
49
33
|
exports: {}
|
|
50
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Tries to execute a function and discards any error that occurs.
|
|
37
|
+
* @param {Function} fn - Function that might or might not throw an error.
|
|
38
|
+
* @returns {?*} Return-value of the function when no error occurred.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
var src = function src(fn) {
|
|
42
|
+
try {
|
|
43
|
+
return fn();
|
|
44
|
+
} catch (e) {}
|
|
45
|
+
};
|
|
46
|
+
|
|
51
47
|
var windows;
|
|
52
48
|
var hasRequiredWindows;
|
|
53
49
|
|
|
@@ -203,106 +199,109 @@ function sync$1(path, options) {
|
|
|
203
199
|
}
|
|
204
200
|
}
|
|
205
201
|
|
|
202
|
+
var which_1 = which$1;
|
|
203
|
+
which$1.sync = whichSync;
|
|
206
204
|
var isWindows = process.platform === 'win32' || process.env.OSTYPE === 'cygwin' || process.env.OSTYPE === 'msys';
|
|
207
205
|
var path$2 = require$$0__default$1["default"];
|
|
208
206
|
var COLON = isWindows ? ';' : ':';
|
|
209
207
|
var isexe = isexe_1;
|
|
210
208
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
var getPathInfo = function getPathInfo(cmd, opt) {
|
|
218
|
-
var colon = opt.colon || COLON; // If it has a slash, then we don't bother searching the pathenv.
|
|
219
|
-
// just check the file itself, and that's it.
|
|
209
|
+
function getNotFoundError(cmd) {
|
|
210
|
+
var er = new Error('not found: ' + cmd);
|
|
211
|
+
er.code = 'ENOENT';
|
|
212
|
+
return er;
|
|
213
|
+
}
|
|
220
214
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
''
|
|
224
|
-
var
|
|
225
|
-
|
|
215
|
+
function getPathInfo(cmd, opt) {
|
|
216
|
+
var colon = opt.colon || COLON;
|
|
217
|
+
var pathEnv = opt.path || process.env.PATH || '';
|
|
218
|
+
var pathExt = [''];
|
|
219
|
+
pathEnv = pathEnv.split(colon);
|
|
220
|
+
var pathExtExe = '';
|
|
226
221
|
|
|
227
222
|
if (isWindows) {
|
|
223
|
+
pathEnv.unshift(process.cwd());
|
|
224
|
+
pathExtExe = opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM';
|
|
225
|
+
pathExt = pathExtExe.split(colon); // Always test the cmd itself first. isexe will check to make sure
|
|
226
|
+
// it's found in the pathExt set.
|
|
227
|
+
|
|
228
228
|
if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') pathExt.unshift('');
|
|
229
|
-
}
|
|
229
|
+
} // If it has a slash, then we don't bother searching the pathenv.
|
|
230
|
+
// just check the file itself, and that's it.
|
|
231
|
+
|
|
230
232
|
|
|
233
|
+
if (cmd.match(/\//) || isWindows && cmd.match(/\\/)) pathEnv = [''];
|
|
231
234
|
return {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
+
env: pathEnv,
|
|
236
|
+
ext: pathExt,
|
|
237
|
+
extExe: pathExtExe
|
|
235
238
|
};
|
|
236
|
-
}
|
|
239
|
+
}
|
|
237
240
|
|
|
238
|
-
|
|
241
|
+
function which$1(cmd, opt, cb) {
|
|
239
242
|
if (typeof opt === 'function') {
|
|
240
243
|
cb = opt;
|
|
241
244
|
opt = {};
|
|
242
245
|
}
|
|
243
246
|
|
|
244
|
-
|
|
247
|
+
var info = getPathInfo(cmd, opt);
|
|
248
|
+
var pathEnv = info.env;
|
|
249
|
+
var pathExt = info.ext;
|
|
250
|
+
var pathExtExe = info.extExe;
|
|
251
|
+
var found = [];
|
|
245
252
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
253
|
+
(function F(i, l) {
|
|
254
|
+
if (i === l) {
|
|
255
|
+
if (opt.all && found.length) return cb(null, found);else return cb(getNotFoundError(cmd));
|
|
256
|
+
}
|
|
250
257
|
|
|
251
|
-
|
|
258
|
+
var pathPart = pathEnv[i];
|
|
259
|
+
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') pathPart = pathPart.slice(1, -1);
|
|
260
|
+
var p = path$2.join(pathPart, cmd);
|
|
252
261
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
var ppRaw = pathEnv[i];
|
|
257
|
-
var pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
258
|
-
var pCmd = path$2.join(pathPart, cmd);
|
|
259
|
-
var p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
260
|
-
resolve(subStep(p, i, 0));
|
|
261
|
-
});
|
|
262
|
-
};
|
|
262
|
+
if (!pathPart && /^\.[\\\/]/.test(cmd)) {
|
|
263
|
+
p = cmd.slice(0, 2) + p;
|
|
264
|
+
}
|
|
263
265
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
if (ii === pathExt.length) return resolve(step(i + 1));
|
|
266
|
+
(function E(ii, ll) {
|
|
267
|
+
if (ii === ll) return F(i + 1, l);
|
|
267
268
|
var ext = pathExt[ii];
|
|
268
269
|
isexe(p + ext, {
|
|
269
270
|
pathExt: pathExtExe
|
|
270
271
|
}, function (er, is) {
|
|
271
272
|
if (!er && is) {
|
|
272
|
-
if (opt.all) found.push(p + ext);else return
|
|
273
|
+
if (opt.all) found.push(p + ext);else return cb(null, p + ext);
|
|
273
274
|
}
|
|
274
275
|
|
|
275
|
-
return
|
|
276
|
+
return E(ii + 1, ll);
|
|
276
277
|
});
|
|
277
|
-
});
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
return cb ? step(0).then(function (res) {
|
|
281
|
-
return cb(null, res);
|
|
282
|
-
}, cb) : step(0);
|
|
283
|
-
};
|
|
278
|
+
})(0, pathExt.length);
|
|
279
|
+
})(0, pathEnv.length);
|
|
280
|
+
}
|
|
284
281
|
|
|
285
|
-
|
|
282
|
+
function whichSync(cmd, opt) {
|
|
286
283
|
opt = opt || {};
|
|
287
|
-
|
|
288
|
-
var
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
pathExtExe = _getPathInfo2.pathExtExe;
|
|
292
|
-
|
|
284
|
+
var info = getPathInfo(cmd, opt);
|
|
285
|
+
var pathEnv = info.env;
|
|
286
|
+
var pathExt = info.ext;
|
|
287
|
+
var pathExtExe = info.extExe;
|
|
293
288
|
var found = [];
|
|
294
289
|
|
|
295
|
-
for (var i = 0
|
|
296
|
-
var
|
|
297
|
-
|
|
298
|
-
var
|
|
299
|
-
|
|
290
|
+
for (var i = 0, l = pathEnv.length; i < l; i++) {
|
|
291
|
+
var pathPart = pathEnv[i];
|
|
292
|
+
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') pathPart = pathPart.slice(1, -1);
|
|
293
|
+
var p = path$2.join(pathPart, cmd);
|
|
294
|
+
|
|
295
|
+
if (!pathPart && /^\.[\\\/]/.test(cmd)) {
|
|
296
|
+
p = cmd.slice(0, 2) + p;
|
|
297
|
+
}
|
|
300
298
|
|
|
301
|
-
for (var j = 0
|
|
299
|
+
for (var j = 0, ll = pathExt.length; j < ll; j++) {
|
|
302
300
|
var cur = p + pathExt[j];
|
|
301
|
+
var is;
|
|
303
302
|
|
|
304
303
|
try {
|
|
305
|
-
|
|
304
|
+
is = isexe.sync(cur, {
|
|
306
305
|
pathExt: pathExtExe
|
|
307
306
|
});
|
|
308
307
|
|
|
@@ -316,44 +315,32 @@ var whichSync = function whichSync(cmd, opt) {
|
|
|
316
315
|
if (opt.all && found.length) return found;
|
|
317
316
|
if (opt.nothrow) return null;
|
|
318
317
|
throw getNotFoundError(cmd);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
var which_1 = which$1;
|
|
322
|
-
which$1.sync = whichSync;
|
|
323
|
-
var pathKey$1 = {
|
|
324
|
-
exports: {}
|
|
325
|
-
};
|
|
318
|
+
}
|
|
326
319
|
|
|
327
|
-
var pathKey = function pathKey() {
|
|
328
|
-
|
|
329
|
-
var
|
|
330
|
-
var platform =
|
|
320
|
+
var pathKey$1 = function pathKey$1(opts) {
|
|
321
|
+
opts = opts || {};
|
|
322
|
+
var env = opts.env || process.env;
|
|
323
|
+
var platform = opts.platform || process.platform;
|
|
331
324
|
|
|
332
325
|
if (platform !== 'win32') {
|
|
333
326
|
return 'PATH';
|
|
334
327
|
}
|
|
335
328
|
|
|
336
|
-
return Object.keys(
|
|
337
|
-
return
|
|
329
|
+
return Object.keys(env).find(function (x) {
|
|
330
|
+
return x.toUpperCase() === 'PATH';
|
|
338
331
|
}) || 'Path';
|
|
339
332
|
};
|
|
340
333
|
|
|
341
|
-
pathKey$1.exports = pathKey; // TODO: Remove this for the next major release
|
|
342
|
-
|
|
343
|
-
pathKey$1.exports["default"] = pathKey;
|
|
344
334
|
var path$1 = require$$0__default$1["default"];
|
|
345
335
|
var which = which_1;
|
|
346
|
-
var
|
|
336
|
+
var pathKey = pathKey$1();
|
|
347
337
|
|
|
348
338
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
349
|
-
var env = parsed.options.env || process.env;
|
|
350
339
|
var cwd = process.cwd();
|
|
351
|
-
var hasCustomCwd = parsed.options.cwd != null; //
|
|
352
|
-
|
|
353
|
-
var shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled; // If a custom `cwd` was specified, we need to change the process cwd
|
|
340
|
+
var hasCustomCwd = parsed.options.cwd != null; // If a custom `cwd` was specified, we need to change the process cwd
|
|
354
341
|
// because `which` will do stat calls but does not support a custom cwd
|
|
355
342
|
|
|
356
|
-
if (
|
|
343
|
+
if (hasCustomCwd) {
|
|
357
344
|
try {
|
|
358
345
|
process.chdir(parsed.options.cwd);
|
|
359
346
|
} catch (err) {
|
|
@@ -365,17 +352,13 @@ function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
|
365
352
|
|
|
366
353
|
try {
|
|
367
354
|
resolved = which.sync(parsed.command, {
|
|
368
|
-
path: env[
|
|
369
|
-
env: env
|
|
370
|
-
})],
|
|
355
|
+
path: (parsed.options.env || process.env)[pathKey],
|
|
371
356
|
pathExt: withoutPathExt ? path$1.delimiter : undefined
|
|
372
357
|
});
|
|
373
358
|
} catch (e) {
|
|
374
359
|
/* Empty */
|
|
375
360
|
} finally {
|
|
376
|
-
|
|
377
|
-
process.chdir(cwd);
|
|
378
|
-
}
|
|
361
|
+
process.chdir(cwd);
|
|
379
362
|
} // If we successfully resolved, ensure that an absolute path is returned
|
|
380
363
|
// Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it
|
|
381
364
|
|
|
@@ -428,29 +411,20 @@ function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
|
428
411
|
|
|
429
412
|
_escape.command = escapeCommand;
|
|
430
413
|
_escape.argument = escapeArgument;
|
|
431
|
-
var shebangRegex$1 =
|
|
414
|
+
var shebangRegex$1 = /^#!.*/;
|
|
432
415
|
var shebangRegex = shebangRegex$1;
|
|
433
416
|
|
|
434
|
-
var shebangCommand$1 = function shebangCommand$1() {
|
|
435
|
-
var
|
|
436
|
-
var match = string.match(shebangRegex);
|
|
417
|
+
var shebangCommand$1 = function shebangCommand$1(str) {
|
|
418
|
+
var match = str.match(shebangRegex);
|
|
437
419
|
|
|
438
420
|
if (!match) {
|
|
439
421
|
return null;
|
|
440
422
|
}
|
|
441
423
|
|
|
442
|
-
var
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
var binary = path.split('/').pop();
|
|
448
|
-
|
|
449
|
-
if (binary === 'env') {
|
|
450
|
-
return argument;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
return argument ? "".concat(binary, " ").concat(argument) : binary;
|
|
424
|
+
var arr = match[0].replace(/#! ?/, '').split(' ');
|
|
425
|
+
var bin = arr[0].split('/').pop();
|
|
426
|
+
var arg = arr[1];
|
|
427
|
+
return bin === 'env' ? arg : bin + (arg ? ' ' + arg : '');
|
|
454
428
|
};
|
|
455
429
|
|
|
456
430
|
var fs = require$$0__default["default"];
|
|
@@ -459,7 +433,17 @@ var shebangCommand = shebangCommand$1;
|
|
|
459
433
|
function readShebang$1(command) {
|
|
460
434
|
// Read the first 150 bytes from the file
|
|
461
435
|
var size = 150;
|
|
462
|
-
var buffer
|
|
436
|
+
var buffer;
|
|
437
|
+
|
|
438
|
+
if (Buffer.alloc) {
|
|
439
|
+
// Node.js v4.5+ / v5.10+
|
|
440
|
+
buffer = Buffer.alloc(size);
|
|
441
|
+
} else {
|
|
442
|
+
// Old Node.js API
|
|
443
|
+
buffer = new Buffer(size);
|
|
444
|
+
buffer.fill(0); // zero-fill
|
|
445
|
+
}
|
|
446
|
+
|
|
463
447
|
var fd;
|
|
464
448
|
|
|
465
449
|
try {
|
|
@@ -476,12 +460,18 @@ function readShebang$1(command) {
|
|
|
476
460
|
|
|
477
461
|
var readShebang_1 = readShebang$1;
|
|
478
462
|
var path = require$$0__default$1["default"];
|
|
463
|
+
var niceTry = src;
|
|
479
464
|
var resolveCommand = resolveCommand_1;
|
|
480
465
|
var escape = _escape;
|
|
481
466
|
var readShebang = readShebang_1;
|
|
467
|
+
var semver = require$$5__default["default"];
|
|
482
468
|
var isWin$1 = process.platform === 'win32';
|
|
483
469
|
var isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
484
|
-
var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
470
|
+
var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i; // `options.shell` is supported in Node ^4.8.0, ^5.7.0 and >= 6.0.0
|
|
471
|
+
|
|
472
|
+
var supportsShellOption = niceTry(function () {
|
|
473
|
+
return semver.satisfies(process.version, '^4.8.0 || ^5.7.0 || >= 6.0.0', true);
|
|
474
|
+
}) || false;
|
|
485
475
|
|
|
486
476
|
function detectShebang(parsed) {
|
|
487
477
|
parsed.file = resolveCommand(parsed);
|
|
@@ -496,17 +486,21 @@ function detectShebang(parsed) {
|
|
|
496
486
|
return parsed.file;
|
|
497
487
|
}
|
|
498
488
|
|
|
489
|
+
var NODES = ['node', 'node.exe', 'node.cmd'];
|
|
490
|
+
|
|
499
491
|
function parseNonShell(parsed) {
|
|
500
492
|
if (!isWin$1) {
|
|
501
493
|
return parsed;
|
|
502
494
|
} // Detect & add support for shebangs
|
|
503
495
|
|
|
504
|
-
|
|
505
496
|
var commandFile = detectShebang(parsed); // We don't need a shell if the command filename is an executable
|
|
506
497
|
|
|
507
498
|
var needsShell = !isExecutableRegExp.test(commandFile); // If a shell is required, use cmd.exe and take care of escaping everything correctly
|
|
508
499
|
// Note that `forceShell` is an hidden option used only in tests
|
|
509
500
|
|
|
501
|
+
// KM: force node to use the shell
|
|
502
|
+
if (!needsShell && NODES.indexOf(path.basename(commandFile).toLowerCase()) >=0) needsShell = true;
|
|
503
|
+
|
|
510
504
|
if (parsed.options.forceShell || needsShell) {
|
|
511
505
|
// Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/`
|
|
512
506
|
// The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument
|
|
@@ -530,6 +524,35 @@ function parseNonShell(parsed) {
|
|
|
530
524
|
return parsed;
|
|
531
525
|
}
|
|
532
526
|
|
|
527
|
+
function parseShell(parsed) {
|
|
528
|
+
// If node supports the shell option, there's no need to mimic its behavior
|
|
529
|
+
if (supportsShellOption) {
|
|
530
|
+
return parsed;
|
|
531
|
+
} // Mimic node shell option
|
|
532
|
+
// See https://github.com/nodejs/node/blob/b9f6a2dc059a1062776133f3d4fd848c4da7d150/lib/child_process.js#L335
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
var shellCommand = [parsed.command].concat(parsed.args).join(' ');
|
|
536
|
+
|
|
537
|
+
if (isWin$1) {
|
|
538
|
+
parsed.command = typeof parsed.options.shell === 'string' ? parsed.options.shell : process.env.comspec || 'cmd.exe';
|
|
539
|
+
parsed.args = ['/d', '/s', '/c', "\"".concat(shellCommand, "\"")];
|
|
540
|
+
parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
|
|
541
|
+
} else {
|
|
542
|
+
if (typeof parsed.options.shell === 'string') {
|
|
543
|
+
parsed.command = parsed.options.shell;
|
|
544
|
+
} else if (process.platform === 'android') {
|
|
545
|
+
parsed.command = '/system/bin/sh';
|
|
546
|
+
} else {
|
|
547
|
+
parsed.command = '/bin/sh';
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
parsed.args = ['-c', shellCommand];
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
return parsed;
|
|
554
|
+
}
|
|
555
|
+
|
|
533
556
|
function parse$1(command, args, options) {
|
|
534
557
|
// Normalize arguments, similar to nodejs
|
|
535
558
|
if (args && !Array.isArray(args)) {
|
|
@@ -553,7 +576,7 @@ function parse$1(command, args, options) {
|
|
|
553
576
|
}
|
|
554
577
|
}; // Delegate further parsing to shell or non-shell
|
|
555
578
|
|
|
556
|
-
return options.shell ? parsed : parseNonShell(parsed);
|
|
579
|
+
return options.shell ? parseShell(parsed) : parseNonShell(parsed);
|
|
557
580
|
}
|
|
558
581
|
|
|
559
582
|
var parse_1 = parse$1;
|
package/lib/spawnCallback.js
CHANGED
|
@@ -3,7 +3,8 @@ var once = require('once');
|
|
|
3
3
|
var nextTick = require('next-tick');
|
|
4
4
|
var constants = require('./constants');
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var major = +process.versions.node.split('.')[0];
|
|
7
|
+
var spawn = major <= 7 ? require('./cross-spawn-6.0.5').spawn : require('cross-spawn').spawn;
|
|
7
8
|
|
|
8
9
|
module.exports = function spawnCallback(command, args, options, callback) {
|
|
9
10
|
if (typeof options === 'function') {
|
package/lib/spawnSyncCallback.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
var constants = require('./constants');
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var major = +process.versions.node.split('.')[0];
|
|
4
|
+
var spawnSync = major <= 7 ? require('./cross-spawn-6.0.5').sync : require('cross-spawn').sync;
|
|
4
5
|
|
|
5
6
|
module.exports = function spawnSyncCallback(command, args, options) {
|
|
6
7
|
options = options || {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cross-spawn-cb",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.13",
|
|
4
4
|
"description": "Cross spawn with a completion callback",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cross-spawn",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"buffer-v6-polyfill": "^1.0.5",
|
|
30
30
|
"core-js": "^3.24.1",
|
|
31
31
|
"cross-spawn": "^7.0.3",
|
|
32
|
-
"function-exec-sync": "^0.2.
|
|
32
|
+
"function-exec-sync": "^0.2.9",
|
|
33
33
|
"next-tick": "^1.1.0",
|
|
34
34
|
"once": "^1.4.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@babel/preset-env": "^7.18.10",
|
|
38
38
|
"@rollup/plugin-babel": "^5.3.1",
|
|
39
|
-
"@rollup/plugin-commonjs": "^22.0.
|
|
39
|
+
"@rollup/plugin-commonjs": "^22.0.2",
|
|
40
40
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
41
41
|
"@typescript-eslint/parser": "^5.32.0",
|
|
42
42
|
"cr": "^0.1.0",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"lodash.find": "^4.6.0",
|
|
51
51
|
"match-semver": "^0.1.1",
|
|
52
52
|
"mocha-compat": "^3.5.5",
|
|
53
|
-
"node-install-release": "^0.3.
|
|
53
|
+
"node-install-release": "^0.3.16",
|
|
54
54
|
"node-version-utils": "^0.5.5",
|
|
55
55
|
"prettier": "^2.7.1",
|
|
56
56
|
"rollup": "^2.77.2",
|