summaryrefslogtreecommitdiff
path: root/node_modules/spawn-sync/lib
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/spawn-sync/lib')
-rw-r--r--node_modules/spawn-sync/lib/json-buffer/LICENSE22
-rw-r--r--node_modules/spawn-sync/lib/json-buffer/README.md1
-rw-r--r--node_modules/spawn-sync/lib/json-buffer/index.js56
-rw-r--r--node_modules/spawn-sync/lib/spawn-sync.js89
-rw-r--r--node_modules/spawn-sync/lib/worker.js56
5 files changed, 0 insertions, 224 deletions
diff --git a/node_modules/spawn-sync/lib/json-buffer/LICENSE b/node_modules/spawn-sync/lib/json-buffer/LICENSE
deleted file mode 100644
index f04be4e..0000000
--- a/node_modules/spawn-sync/lib/json-buffer/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2013 Dominic Tarr
-
-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. \ No newline at end of file
diff --git a/node_modules/spawn-sync/lib/json-buffer/README.md b/node_modules/spawn-sync/lib/json-buffer/README.md
deleted file mode 100644
index 5fd5b29..0000000
--- a/node_modules/spawn-sync/lib/json-buffer/README.md
+++ /dev/null
@@ -1 +0,0 @@
-Code based on https://github.com/dominictarr/json-buffer but adapted to be simpler to run in a purely node.js environment \ No newline at end of file
diff --git a/node_modules/spawn-sync/lib/json-buffer/index.js b/node_modules/spawn-sync/lib/json-buffer/index.js
deleted file mode 100644
index d79314e..0000000
--- a/node_modules/spawn-sync/lib/json-buffer/index.js
+++ /dev/null
@@ -1,56 +0,0 @@
-
-'use strict';
-
-//TODO: handle reviver/dehydrate function like normal
-//and handle indentation, like normal.
-//if anyone needs this... please send pull request.
-
-exports.stringify = function stringify (o) {
- if(o && Buffer.isBuffer(o))
- return JSON.stringify(':base64:' + o.toString('base64'))
-
- if(o && o.toJSON)
- o = o.toJSON()
-
- if(o && 'object' === typeof o) {
- var s = ''
- var array = Array.isArray(o)
- s = array ? '[' : '{'
- var first = true
-
- for(var k in o) {
- var ignore = 'function' == typeof o[k] || (!array && 'undefined' === typeof o[k])
- if(Object.hasOwnProperty.call(o, k) && !ignore) {
- if(!first)
- s += ','
- first = false
- if (array) {
- s += stringify(o[k])
- } else if (o[k] !== void(0)) {
- s += stringify(k) + ':' + stringify(o[k])
- }
- }
- }
-
- s += array ? ']' : '}'
-
- return s
- } else if ('string' === typeof o) {
- return JSON.stringify(/^:/.test(o) ? ':' + o : o)
- } else if ('undefined' === typeof o) {
- return 'null';
- } else
- return JSON.stringify(o)
-}
-
-exports.parse = function (s) {
- return JSON.parse(s, function (key, value) {
- if('string' === typeof value) {
- if(/^:base64:/.test(value))
- return new Buffer(value.substring(8), 'base64')
- else
- return /^:/.test(value) ? value.substring(1) : value
- }
- return value
- })
-} \ No newline at end of file
diff --git a/node_modules/spawn-sync/lib/spawn-sync.js b/node_modules/spawn-sync/lib/spawn-sync.js
deleted file mode 100644
index 5dbc530..0000000
--- a/node_modules/spawn-sync/lib/spawn-sync.js
+++ /dev/null
@@ -1,89 +0,0 @@
-'use strict';
-
-var path = require('path');
-var fs = require('fs');
-var tmpdir = require('os').tmpdir || require('os-shim').tmpdir;
-var cp = require('child_process');
-var sleep;
-var JSON = require('./json-buffer');
-try {
- sleep = require('try-thread-sleep');
-} catch (ex) {
- console.warn('Native thread-sleep not available.');
- console.warn('This will result in much slower performance, but it will still work.');
- console.warn('You should re-install spawn-sync or upgrade to the lastest version of node if possible.');
- console.warn('Check ' + path.resolve(__dirname, '../error.log') + ' for more details');
- sleep = function () {};
-}
-
-var temp = path.normalize(path.join(tmpdir(), 'spawn-sync'));
-
-function randomFileName(name) {
- function randomHash(count) {
- if (count === 1)
- return parseInt(16*Math.random(), 10).toString(16);
- else {
- var hash = '';
- for (var i=0; i<count; i++)
- hash += randomHash(1);
- return hash;
- }
- }
-
- return temp + '_' + name + '_' + String(process.pid) + randomHash(20);
-}
-function unlink(filename) {
- try {
- fs.unlinkSync(filename);
- } catch (ex) {
- if (ex.code !== 'ENOENT') throw ex;
- }
-}
-function tryUnlink(filename) {
- // doesn't matter too much if we fail to delete temp files
- try {
- fs.unlinkSync(filename);
- } catch(e) {}
-}
-
-function invoke(cmd) {
- // location to keep flag for busy waiting fallback
- var finished = randomFileName("finished");
- unlink(finished);
- if (process.platform === 'win32') {
- cmd = cmd + '& echo "finished" > ' + finished;
- } else {
- cmd = cmd + '; echo "finished" > ' + finished;
- }
- cp.exec(cmd);
-
- while (!fs.existsSync(finished)) {
- // busy wait
- sleep(200);
- }
-
- tryUnlink(finished);
-
- return 0;
-}
-
-module.exports = spawnSyncFallback;
-function spawnSyncFallback(cmd, commandArgs, options) {
- var args = [];
- for (var i = 0; i < arguments.length; i++) {
- args.push(arguments[i]);
- }
-
- // node.js script to run the command
- var worker = path.normalize(__dirname + '/worker.js');
- // location to store arguments
- var input = randomFileName('input');
- var output = randomFileName('output');
- unlink(output);
-
- fs.writeFileSync(input, JSON.stringify(args));
- invoke('"' + process.execPath + '" "' + worker + '" "' + input + '" "' + output + '"');
- var res = JSON.parse(fs.readFileSync(output, 'utf8'));
- tryUnlink(input);tryUnlink(output);
- return res;
-}
diff --git a/node_modules/spawn-sync/lib/worker.js b/node_modules/spawn-sync/lib/worker.js
deleted file mode 100644
index 3e050ac..0000000
--- a/node_modules/spawn-sync/lib/worker.js
+++ /dev/null
@@ -1,56 +0,0 @@
-'use strict';
-
-var cp = require('child_process');
-var fs = require('fs');
-var concat = require('concat-stream');
-var JSON = require('./json-buffer');
-
-var inputFile = process.argv[2];
-var outputFile = process.argv[3];
-
-var args = JSON.parse(fs.readFileSync(inputFile, 'utf8'));
-function output(result) {
- fs.writeFileSync(outputFile, JSON.stringify(result));
-}
-
-var child = cp.spawn.apply(cp, args);
-var options = (args[2] && typeof args[2] === 'object') ?
- args[2] :
- (args[1] && typeof args[1] === 'object' && !Array.isArray(args[1])) ?
- args[1] :
- {};
-
-var complete = false;
-var stdout, stderr;
-child.stdout && child.stdout.pipe(concat(function (buf) {
- stdout = buf.length ? buf : new Buffer(0);
-}));
-child.stderr && child.stderr.pipe(concat(function (buf) {
- stderr = buf.length ? buf : new Buffer(0);
-}));
-child.on('error', function (err) {
- output({pid: child.pid, error: err.message});
-});
-child.on('close', function (status, signal) {
- if (options.encoding && options.encoding !== 'buffer') {
- stdout = stdout.toString(options.encoding);
- stderr = stderr.toString(options.encoding);
- }
- output({
- pid: child.pid,
- output: [null, stdout, stderr],
- stdout: stdout,
- stderr: stderr,
- status: status,
- signal: signal
- });
-});
-
-if (options.timeout && typeof options.timeout === 'number') {
- setTimeout(function () {
- child.kill(options.killSignal || 'SIGTERM');
- }, options.timeout);
-}
-if (options.input && (typeof options.input === 'string' || Buffer.isBuffer(options.input))) {
- child.stdin.end(options.input);
-}