Comparing version 6.1.8 to 6.1.9
"use strict"; | ||
const cp = require('child_process'); | ||
const once = require('../function/once'); | ||
const {spawn} = require('child_process'); | ||
const wait = require('./wait'); | ||
const drain = require('../stream/drain'); | ||
//callback(err, exit, lastline); | ||
module.exports = function(cmd /*, options, chain*/) { | ||
module.exports = async function(cmd, args = [], options = {}) { | ||
if(!Array.isArray(args)) | ||
(options = args), (args = options.args || []); | ||
var args = Array.from(arguments); | ||
var chain = once(args.pop()); | ||
cmd = args.shift(); | ||
var options = args.shift() || {}; | ||
var child = spawn(cmd, args, options); | ||
if(Array.isArray(options)) | ||
options = { args : options}; | ||
let [stdout] = await Promise.all([drain(child.stdout), wait(child)]); | ||
var ps = cp.spawn(cmd, options.args || [], options); | ||
var _stdout = ""; | ||
var _stderr = ""; | ||
ps.on('error', chain); | ||
ps.stdout.on('data', function(data) { _stdout += data; }); | ||
ps.stderr.on('data', function(data) { _stderr += data; }); | ||
ps.on('close', function(exit) { | ||
return chain(exit, _stdout, _stderr); | ||
}); | ||
return ps; | ||
return stdout; | ||
}; | ||
{ | ||
"name": "nyks", | ||
"version": "6.1.8", | ||
"version": "6.1.9", | ||
"description": "nodejs exupery style", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72205
1901