diff options
Diffstat (limited to 'deps/npm/node_modules/cross-spawn/lib/util')
5 files changed, 0 insertions, 128 deletions
diff --git a/deps/npm/node_modules/cross-spawn/lib/util/escapeArgument.js b/deps/npm/node_modules/cross-spawn/lib/util/escapeArgument.js deleted file mode 100644 index 367263f669..0000000000 --- a/deps/npm/node_modules/cross-spawn/lib/util/escapeArgument.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; - -function escapeArgument(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; -} - -module.exports = escapeArgument; diff --git a/deps/npm/node_modules/cross-spawn/lib/util/escapeCommand.js b/deps/npm/node_modules/cross-spawn/lib/util/escapeCommand.js deleted file mode 100644 index d9c25b2656..0000000000 --- a/deps/npm/node_modules/cross-spawn/lib/util/escapeCommand.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -var escapeArgument = require('./escapeArgument'); - -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 : escapeArgument(command, true); -} - -module.exports = escapeCommand; diff --git a/deps/npm/node_modules/cross-spawn/lib/util/hasEmptyArgumentBug.js b/deps/npm/node_modules/cross-spawn/lib/util/hasEmptyArgumentBug.js deleted file mode 100644 index 9f2eba6355..0000000000 --- a/deps/npm/node_modules/cross-spawn/lib/util/hasEmptyArgumentBug.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -// See: https://github.com/IndigoUnited/node-cross-spawn/pull/34#issuecomment-221623455 -function hasEmptyArgumentBug() { - var nodeVer; - - if (process.platform !== 'win32') { - return false; - } - - nodeVer = process.version.substr(1).split('.').map(function (num) { - return parseInt(num, 10); - }); - - return (nodeVer[0] === 0 && nodeVer[1] < 12); -} - -module.exports = hasEmptyArgumentBug(); diff --git a/deps/npm/node_modules/cross-spawn/lib/util/readShebang.js b/deps/npm/node_modules/cross-spawn/lib/util/readShebang.js deleted file mode 100644 index 2cf3541c99..0000000000 --- a/deps/npm/node_modules/cross-spawn/lib/util/readShebang.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; - -var fs = require('fs'); -var LRU = require('lru-cache'); -var shebangCommand = require('shebang-command'); - -var shebangCache = new LRU({ max: 50, maxAge: 30 * 1000 }); // Cache just for 30sec - -function readShebang(command) { - var buffer; - var fd; - 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 */ } - - // Attempt to extract shebang (null is returned if not a shebang) - shebang = shebangCommand(buffer.toString()); - - // Store the shebang in the cache - shebangCache.set(command, shebang); - - return shebang; -} - -module.exports = readShebang; diff --git a/deps/npm/node_modules/cross-spawn/lib/util/resolveCommand.js b/deps/npm/node_modules/cross-spawn/lib/util/resolveCommand.js deleted file mode 100644 index b7a9490974..0000000000 --- a/deps/npm/node_modules/cross-spawn/lib/util/resolveCommand.js +++ /dev/null @@ -1,31 +0,0 @@ -'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 - -function resolveCommand(command, noExtension) { - var resolved; - - 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; |