aboutsummaryrefslogtreecommitdiff
path: root/node_modules/cross-spawn-async
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/cross-spawn-async')
-rw-r--r--node_modules/cross-spawn-async/.editorconfig15
-rw-r--r--node_modules/cross-spawn-async/.eslintrc7
-rw-r--r--node_modules/cross-spawn-async/.npmignore3
-rw-r--r--node_modules/cross-spawn-async/.travis.yml7
-rw-r--r--node_modules/cross-spawn-async/LICENSE19
-rw-r--r--node_modules/cross-spawn-async/README.md58
-rw-r--r--node_modules/cross-spawn-async/appveyor.yml30
-rw-r--r--node_modules/cross-spawn-async/index.js27
-rw-r--r--node_modules/cross-spawn-async/lib/enoent.js51
-rw-r--r--node_modules/cross-spawn-async/lib/parse.js128
-rw-r--r--node_modules/cross-spawn-async/lib/resolveCommand.js38
l---------node_modules/cross-spawn-async/node_modules/.bin/which1
-rw-r--r--node_modules/cross-spawn-async/package.json46
13 files changed, 430 insertions, 0 deletions
diff --git a/node_modules/cross-spawn-async/.editorconfig b/node_modules/cross-spawn-async/.editorconfig
new file mode 100644
index 000000000..8bc4f108d
--- /dev/null
+++ b/node_modules/cross-spawn-async/.editorconfig
@@ -0,0 +1,15 @@
+root = true
+
+[*]
+indent_style = space
+indent_size = 4
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.md]
+trim_trailing_whitespace = false
+
+[package.json]
+indent_size = 2
diff --git a/node_modules/cross-spawn-async/.eslintrc b/node_modules/cross-spawn-async/.eslintrc
new file mode 100644
index 000000000..f34b41d96
--- /dev/null
+++ b/node_modules/cross-spawn-async/.eslintrc
@@ -0,0 +1,7 @@
+{
+ "root": true,
+ "extends": [
+ "@satazor/eslint-config/es5",
+ "@satazor/eslint-config/addons/node"
+ ]
+} \ No newline at end of file
diff --git a/node_modules/cross-spawn-async/.npmignore b/node_modules/cross-spawn-async/.npmignore
new file mode 100644
index 000000000..93f2f731a
--- /dev/null
+++ b/node_modules/cross-spawn-async/.npmignore
@@ -0,0 +1,3 @@
+node_modules/
+npm-debug.*
+test/
diff --git a/node_modules/cross-spawn-async/.travis.yml b/node_modules/cross-spawn-async/.travis.yml
new file mode 100644
index 000000000..22e38a0fd
--- /dev/null
+++ b/node_modules/cross-spawn-async/.travis.yml
@@ -0,0 +1,7 @@
+language: node_js
+node_js:
+ - '0.10'
+ - '0.12'
+ - '4'
+ - '5'
+ - '6'
diff --git a/node_modules/cross-spawn-async/LICENSE b/node_modules/cross-spawn-async/LICENSE
new file mode 100644
index 000000000..e898822ad
--- /dev/null
+++ b/node_modules/cross-spawn-async/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2015 IndigoUnited
+
+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 --git a/node_modules/cross-spawn-async/README.md b/node_modules/cross-spawn-async/README.md
new file mode 100644
index 000000000..8b3bd6983
--- /dev/null
+++ b/node_modules/cross-spawn-async/README.md
@@ -0,0 +1,58 @@
+# cross-spawn-async
+
+[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Build status][appveyor-image]][appveyor-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url]
+
+[npm-url]:https://npmjs.org/package/cross-spawn-async
+[downloads-image]:http://img.shields.io/npm/dm/cross-spawn-async.svg
+[npm-image]:http://img.shields.io/npm/v/cross-spawn-async.svg
+[travis-url]:https://travis-ci.org/IndigoUnited/node-cross-spawn-async
+[travis-image]:http://img.shields.io/travis/IndigoUnited/node-cross-spawn-async/master.svg
+[appveyor-url]:https://ci.appveyor.com/project/satazor/node-cross-spawn-async
+[appveyor-image]:https://img.shields.io/appveyor/ci/satazor/node-cross-spawn-async/master.svg
+[david-dm-url]:https://david-dm.org/IndigoUnited/node-cross-spawn-async
+[david-dm-image]:https://img.shields.io/david/IndigoUnited/node-cross-spawn-async.svg
+[david-dm-dev-url]:https://david-dm.org/IndigoUnited/node-cross-spawn-async#info=devDependencies
+[david-dm-dev-image]:https://img.shields.io/david/dev/IndigoUnited/node-cross-spawn-async.svg
+
+A cross platform solution to node's spawn.
+
+**This module is deprecated, use [cross-spawn](https://github.com/IndigoUnited/node-cross-spawn) instead which no longer requires a build toolchain.**
+
+
+## Installation
+
+`$ npm install cross-spawn-async`
+
+
+## Why
+
+Node has issues when using spawn on Windows:
+
+- It ignores [PATHEXT](https://github.com/joyent/node/issues/2318)
+- It does not support [shebangs](http://pt.wikipedia.org/wiki/Shebang)
+- It does not allow you to run `del` or `dir`
+- It does not properly escape arguments with spaces or special characters
+
+All these issues are handled correctly by `cross-spawn-async`.
+There are some known modules, such as [win-spawn](https://github.com/ForbesLindesay/win-spawn), that try to solve this but they are either broken or provide faulty escaping of shell arguments.
+
+
+## Usage
+
+Exactly the same way as node's [`spawn`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options), so it's a drop in replacement.
+
+```javascript
+var spawn = require('cross-spawn-async');
+
+var child = spawn('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit' });
+```
+
+
+## Tests
+
+`$ npm test`
+
+
+## License
+
+Released under the [MIT License](http://www.opensource.org/licenses/mit-license.php).
diff --git a/node_modules/cross-spawn-async/appveyor.yml b/node_modules/cross-spawn-async/appveyor.yml
new file mode 100644
index 000000000..9b92823ee
--- /dev/null
+++ b/node_modules/cross-spawn-async/appveyor.yml
@@ -0,0 +1,30 @@
+# appveyor file
+# http://www.appveyor.com/docs/appveyor-yml
+
+# build version format
+version: "{build}"
+
+# fix lineendings in Windows
+init:
+ - git config --global core.autocrlf input
+
+# what combinations to test
+environment:
+ matrix:
+ - nodejs_version: 0.10
+ - nodejs_version: 0.12
+ - nodejs_version: 4
+ - nodejs_version: 5
+ - nodejs_version: 6
+
+# get the latest stable version of Node 0.STABLE.latest
+install:
+ - ps: Install-Product node $env:nodejs_version
+ - npm install
+
+build: off
+
+test_script:
+ - node --version
+ - npm --version
+ - cmd: npm test --no-color
diff --git a/node_modules/cross-spawn-async/index.js b/node_modules/cross-spawn-async/index.js
new file mode 100644
index 000000000..92afff083
--- /dev/null
+++ b/node_modules/cross-spawn-async/index.js
@@ -0,0 +1,27 @@
+'use strict';
+
+var cp = require('child_process');
+var parse = require('./lib/parse');
+var enoent = require('./lib/enoent');
+
+function spawn(command, args, options) {
+ var parsed;
+ var spawned;
+
+ // Parse the arguments
+ parsed = parse(command, args, options);
+
+ // Spawn the child process
+ spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
+
+ // Hook into child process "exit" event to emit an error if the command
+ // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
+ enoent.hookChildProcess(spawned, parsed);
+
+ return spawned;
+}
+
+module.exports = spawn;
+module.exports.spawn = spawn;
+module.exports._parse = parse;
+module.exports._enoent = enoent;
diff --git a/node_modules/cross-spawn-async/lib/enoent.js b/node_modules/cross-spawn-async/lib/enoent.js
new file mode 100644
index 000000000..3254833ae
--- /dev/null
+++ b/node_modules/cross-spawn-async/lib/enoent.js
@@ -0,0 +1,51 @@
+'use strict';
+
+var isWin = process.platform === 'win32';
+
+function notFoundError(command, syscall) {
+ var err;
+
+ err = new Error(syscall + ' ' + command + ' ENOENT');
+ err.code = err.errno = 'ENOENT';
+ err.syscall = syscall + ' ' + command;
+
+ return err;
+}
+
+function hookChildProcess(cp, parsed) {
+ var originalEmit;
+
+ if (!isWin) {
+ return;
+ }
+
+ originalEmit = cp.emit;
+ cp.emit = function (name, arg1) {
+ var err;
+
+ // If emitting "exit" event and exit code is 1, we need to check if
+ // the command exists and emit an "error" instead
+ // See: https://github.com/IndigoUnited/node-cross-spawn/issues/16
+ if (name === 'exit') {
+ err = verifyENOENT(arg1, parsed, 'spawn');
+
+ if (err) {
+ return originalEmit.call(cp, 'error', err);
+ }
+ }
+
+ return originalEmit.apply(cp, arguments);
+ };
+}
+
+function verifyENOENT(status, parsed, syscall) {
+ if (isWin && status === 1 && !parsed.file) {
+ return notFoundError(parsed.original, syscall);
+ }
+
+ return null;
+}
+
+module.exports.hookChildProcess = hookChildProcess;
+module.exports.verifyENOENT = verifyENOENT;
+module.exports.notFoundError = notFoundError;
diff --git a/node_modules/cross-spawn-async/lib/parse.js b/node_modules/cross-spawn-async/lib/parse.js
new file mode 100644
index 000000000..923e05e7a
--- /dev/null
+++ b/node_modules/cross-spawn-async/lib/parse.js
@@ -0,0 +1,128 @@
+'use strict';
+
+var fs = require('fs');
+var LRU = require('lru-cache');
+var resolveCommand = require('./resolveCommand');
+
+var isWin = process.platform === 'win32';
+var shebangCache = new LRU({ max: 50, maxAge: 30 * 1000 }); // Cache just for 30sec
+
+function readShebang(command) {
+ var buffer;
+ var fd;
+ var match;
+ var shebang;
+
+ // Check if it is in the cache first
+ if (shebangCache.has(command)) {
+ return shebangCache.get(command);
+ }
+
+ // Read the first 150 bytes from the file
+ buffer = new Buffer(150);
+
+ try {
+ fd = fs.openSync(command, 'r');
+ fs.readSync(fd, buffer, 0, 150, 0);
+ fs.closeSync(fd);
+ } catch (e) { /* empty */ }
+
+ // Check if it is a shebang
+ match = buffer.toString().trim().match(/#!(.+)/i);
+
+ if (match) {
+ shebang = match[1].replace(/\/usr\/bin\/env\s+/i, ''); // Remove /usr/bin/env
+ }
+
+ // Store the shebang in the cache
+ shebangCache.set(command, shebang);
+
+ return shebang;
+}
+
+function escapeArg(arg, quote) {
+ // Convert to string
+ arg = '' + arg;
+
+ // If we are not going to quote the argument,
+ // escape shell metacharacters, including double and single quotes:
+ if (!quote) {
+ arg = arg.replace(/([\(\)%!\^<>&|;,"'\s])/g, '^$1');
+ } else {
+ // Sequence of backslashes followed by a double quote:
+ // double up all the backslashes and escape the double quote
+ arg = arg.replace(/(\\*)"/g, '$1$1\\"');
+
+ // Sequence of backslashes followed by the end of the string
+ // (which will become a double quote later):
+ // double up all the backslashes
+ arg = arg.replace(/(\\*)$/, '$1$1');
+
+ // All other backslashes occur literally
+
+ // Quote the whole thing:
+ arg = '"' + arg + '"';
+ }
+
+ return arg;
+}
+
+function escapeCommand(command) {
+ // Do not escape if this command is not dangerous..
+ // We do this so that commands like "echo" or "ifconfig" work
+ // Quoting them, will make them unaccessible
+ return /^[a-z0-9_-]+$/i.test(command) ? command : escapeArg(command, true);
+}
+
+function parse(command, args, options) {
+ var shebang;
+ var applyQuotes;
+ var file;
+ var original;
+
+ // Normalize arguments, similar to nodejs
+ if (args && !Array.isArray(args)) {
+ options = args;
+ args = null;
+ }
+
+ args = args ? args.slice(0) : []; // Clone array to avoid changing the original
+ options = options || {};
+ original = command;
+
+ if (isWin) {
+ // Detect & add support for shebangs
+ file = resolveCommand(command);
+ file = file || resolveCommand(command, true);
+ shebang = file && readShebang(file);
+
+ if (shebang) {
+ args.unshift(file);
+ command = shebang;
+ }
+
+ // Escape command & arguments
+ applyQuotes = command !== 'echo'; // Do not quote arguments for the special "echo" command
+ command = escapeCommand(command);
+ args = args.map(function (arg) {
+ return escapeArg(arg, applyQuotes);
+ });
+
+ // Use cmd.exe
+ args = ['/s', '/c', '"' + command + (args.length ? ' ' + args.join(' ') : '') + '"'];
+ command = process.env.comspec || 'cmd.exe';
+
+ // Tell node's spawn that the arguments are already escaped
+ options.windowsVerbatimArguments = true;
+ }
+
+ return {
+ command: command,
+ args: args,
+ options: options,
+ file: file,
+ original: original,
+ };
+}
+
+module.exports = parse;
diff --git a/node_modules/cross-spawn-async/lib/resolveCommand.js b/node_modules/cross-spawn-async/lib/resolveCommand.js
new file mode 100644
index 000000000..391d3d9b0
--- /dev/null
+++ b/node_modules/cross-spawn-async/lib/resolveCommand.js
@@ -0,0 +1,38 @@
+'use strict';
+
+var path = require('path');
+var which = require('which');
+var LRU = require('lru-cache');
+
+var commandCache = new LRU({ max: 50, maxAge: 30 * 1000 }); // Cache just for 30sec
+var hasSepInPathRegExp = new RegExp(process.platform === 'win32' ? /[\/\\]/ : /\//);
+
+function resolveCommand(command, noExtension) {
+ var resolved;
+
+ // If command looks like a file path, make it absolute to make it canonical
+ // and also to circuvent a bug in which, see: https://github.com/npm/node-which/issues/33
+ if (hasSepInPathRegExp.test(command)) {
+ command = path.resolve(command);
+ }
+
+ noExtension = !!noExtension;
+ resolved = commandCache.get(command + '!' + noExtension);
+
+ // Check if its resolved in the cache
+ if (commandCache.has(command)) {
+ return commandCache.get(command);
+ }
+
+ try {
+ resolved = !noExtension ?
+ which.sync(command) :
+ which.sync(command, { pathExt: path.delimiter + (process.env.PATHEXT || '') });
+ } catch (e) { /* empty */ }
+
+ commandCache.set(command + '!' + noExtension, resolved);
+
+ return resolved;
+}
+
+module.exports = resolveCommand;
diff --git a/node_modules/cross-spawn-async/node_modules/.bin/which b/node_modules/cross-spawn-async/node_modules/.bin/which
new file mode 120000
index 000000000..091d52ad6
--- /dev/null
+++ b/node_modules/cross-spawn-async/node_modules/.bin/which
@@ -0,0 +1 @@
+../../../which/bin/which \ No newline at end of file
diff --git a/node_modules/cross-spawn-async/package.json b/node_modules/cross-spawn-async/package.json
new file mode 100644
index 000000000..5026fa4f0
--- /dev/null
+++ b/node_modules/cross-spawn-async/package.json
@@ -0,0 +1,46 @@
+{
+ "name": "cross-spawn-async",
+ "version": "2.2.5",
+ "description": "Cross platform child_process#spawn",
+ "main": "index.js",
+ "scripts": {
+ "test": "node test/prepare && mocha --bail test/test",
+ "lint": "eslint '{*.js,lib/**/*.js,test/**/*.js}'"
+ },
+ "bugs": {
+ "url": "https://github.com/IndigoUnited/node-cross-spawn-async/issues/"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/IndigoUnited/node-cross-spawn-async.git"
+ },
+ "keywords": [
+ "spawn",
+ "windows",
+ "cross",
+ "platform",
+ "path",
+ "ext",
+ "path-ext",
+ "path_ext",
+ "shebang",
+ "hashbang",
+ "cmd",
+ "execute"
+ ],
+ "author": "IndigoUnited <hello@indigounited.com> (http://indigounited.com)",
+ "license": "MIT",
+ "dependencies": {
+ "lru-cache": "^4.0.0",
+ "which": "^1.2.8"
+ },
+ "devDependencies": {
+ "@satazor/eslint-config": "^3.0.0",
+ "eslint": "^3.0.0",
+ "expect.js": "^0.3.0",
+ "glob": "^7.0.0",
+ "mkdirp": "^0.5.1",
+ "mocha": "^3.0.2",
+ "rimraf": "^2.5.0"
+ }
+}