From f9159ea2d994e14180fb02ab562f0119513e67cf Mon Sep 17 00:00:00 2001 From: 8cy <50817549+8cy@users.noreply.github.com> Date: Fri, 3 Apr 2020 02:48:28 -0700 Subject: 2020/04/03, 02:47, V1.2.2 --- node_modules/spawn-sync/lib/spawn-sync.js | 89 ------------------------------- 1 file changed, 89 deletions(-) delete mode 100644 node_modules/spawn-sync/lib/spawn-sync.js (limited to 'node_modules/spawn-sync/lib/spawn-sync.js') 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 ' + 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; -} -- cgit v1.2.3