summaryrefslogtreecommitdiff
path: root/node_modules/spawn-sync/lib/worker.js
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-03 02:48:28 -0700
committer8cy <[email protected]>2020-04-03 02:48:28 -0700
commitf9159ea2d994e14180fb02ab562f0119513e67cf (patch)
tree09d14cdf05456567156738b681379d4bccd64e5c /node_modules/spawn-sync/lib/worker.js
parent2020/04/03, 02:42, V1.2.1 (diff)
downloads5nical-f9159ea2d994e14180fb02ab562f0119513e67cf.tar.xz
s5nical-f9159ea2d994e14180fb02ab562f0119513e67cf.zip
2020/04/03, 02:47, V1.2.2
Diffstat (limited to 'node_modules/spawn-sync/lib/worker.js')
-rw-r--r--node_modules/spawn-sync/lib/worker.js56
1 files changed, 0 insertions, 56 deletions
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);
-}