@bodar/totallylazy
Advanced tools
Comparing version 0.460.302 to 0.461.303
{ | ||
"name": "@bodar/totallylazy", | ||
"version": "0.460.302", | ||
"version": "0.461.303", | ||
"description": "Totallylazy", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:bodar/totallylazy.js.git", |
18
run.js
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.run = void 0; | ||
const files_1 = require("./files"); | ||
const child_process_1 = require("child_process"); | ||
const collections_1 = require("./collections"); | ||
const net_1 = require("net"); | ||
function uuid(a, b) { | ||
for (b = a = ''; a++ < 36; b += a * 51 & 52 ? (a ^ 15 ? 8 ^ Math.random() * (a ^ 20 ? 16 : 4) : 4).toString(16) : '-') | ||
; | ||
return b; | ||
} | ||
function run(options) { | ||
const handle = files_1.File.tempDirectory.child(`totallylazy.js-${uuid()}`).absolutePath; | ||
const handler = new collections_1.AsyncIteratorHandler(); | ||
const server = net_1.createServer(connection => { | ||
connection.on('data', (data) => handler.value(data.toString())); | ||
}).listen(handle); | ||
const client = net_1.connect(handle); | ||
const process = child_process_1.spawn(options.command, options.arguments || [], Object.assign(Object.assign({}, options), { stdio: ['ignore', client, client] })); | ||
const process = child_process_1.spawn(options.command, options.arguments || [], Object.assign(Object.assign({}, options), { stdio: ['ignore', 'pipe', 'pipe'] })); | ||
process.stdout.on('data', (data) => handler.value(data.toString())); | ||
process.stderr.on('data', (data) => handler.value(data.toString())); | ||
process.on('close', (code) => { | ||
client.end(); | ||
server.close(); | ||
if (code === 0) { | ||
@@ -25,0 +13,0 @@ handler.close(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
4
460571
6737