machinepack-process
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -49,4 +49,5 @@ module.exports = { | ||
fn: function (inputs,exits) { | ||
var util = require('util'); | ||
var isObject = require('lodash.isobject'); | ||
var isString = require('lodash.isstring'); | ||
var MPJSON = require('machinepack-json'); | ||
@@ -56,3 +57,3 @@ | ||
var val = inputs.value; | ||
if (util.isObject(val)) { | ||
if (isObject(val)) { | ||
val = MPJSON.stringifySafe({value:val}).execSync(); | ||
@@ -65,3 +66,3 @@ } | ||
if (!util.isString(val)) { | ||
if (!isString(val)) { | ||
return exits.couldNotSerialize(); | ||
@@ -68,0 +69,0 @@ } |
@@ -90,6 +90,6 @@ module.exports = { | ||
fn: function (inputs,exits) { | ||
var path = require('path'); | ||
var util = require('util'); | ||
var executeCmdInChildProc = require('child_process').exec; | ||
var isObject = require('lodash.isobject'); | ||
var isUndefined = require('lodash.isundefined'); | ||
@@ -100,3 +100,3 @@ // First, build up the options to pass in to `child_process.exec()`. | ||
// Determine the appropriate `cwd` for `child_process.exec()`. | ||
if (util.isUndefined(inputs.dir)) { | ||
if (isUndefined(inputs.dir)) { | ||
// Default directory to current working directory | ||
@@ -114,3 +114,3 @@ childProcOpts.cwd = process.cwd(); | ||
var timestampBeforeExecutingCmd; | ||
if (!util.isUndefined(inputs.timeout)) { | ||
if (!isUndefined(inputs.timeout)) { | ||
if (inputs.timeout < 1) { | ||
@@ -124,3 +124,3 @@ return exits.error('Invalid timeout (`'+inputs.timeout+'`). Must be greater than zero. Remember: `timeout` should be used to indicate the maximum number of miliseconds to wait for this command to finish before giving up.'); | ||
// If `environmentVars` were provided, pass them in to `child_process.exec()`. | ||
if (!util.isUndefined(inputs.environmentVars)) { | ||
if (!isUndefined(inputs.environmentVars)) { | ||
childProcOpts.env = inputs.environmentVars; | ||
@@ -134,3 +134,3 @@ } | ||
if (err) { | ||
if (!util.isObject(err)) { | ||
if (!isObject(err)) { | ||
return exits.error(err); | ||
@@ -137,0 +137,0 @@ } |
@@ -68,6 +68,7 @@ module.exports = { | ||
fn: function (inputs,exits) { | ||
var util = require('util'); | ||
var isObject = require('lodash.isobject'); | ||
var isFunction = require('lodash.isfunction'); | ||
// Validate that the provided child process instance is at least close to the real deal. | ||
if (!util.isObject(inputs.childProcess) || !util.isFunction(inputs.childProcess.kill) || !util.isFunction(inputs.childProcess.on) || !util.isFunction(inputs.childProcess.removeListener)) { | ||
if (!isObject(inputs.childProcess) || !isFunction(inputs.childProcess.kill) || !isFunction(inputs.childProcess.on) || !isFunction(inputs.childProcess.removeListener)) { | ||
return exits.invalidChildProcess(); | ||
@@ -74,0 +75,0 @@ } |
@@ -72,6 +72,5 @@ module.exports = { | ||
fn: function (inputs,exits) { | ||
var path = require('path'); | ||
var util = require('util'); | ||
var spawn = require('child_process').spawn; | ||
var isUndefined = require('lodash.isundefined'); | ||
@@ -82,3 +81,3 @@ // First, build up the options to pass in to `child_process.spawn()`. | ||
// Determine the appropriate `cwd` for `child_process.spawn()`. | ||
if (util.isUndefined(inputs.dir)) { | ||
if (isUndefined(inputs.dir)) { | ||
// Default directory to current working directory | ||
@@ -94,3 +93,3 @@ childProcOpts.cwd = process.cwd(); | ||
// If `environmentVars` were provided, pass them in to `child_process.exec()`. | ||
if (!util.isUndefined(inputs.environmentVars)) { | ||
if (!isUndefined(inputs.environmentVars)) { | ||
childProcOpts.env = inputs.environmentVars; | ||
@@ -97,0 +96,0 @@ } |
{ | ||
"name": "machinepack-process", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Work with child procs and the running process.", | ||
@@ -16,2 +16,6 @@ "scripts": { | ||
"dependencies": { | ||
"lodash.isfunction": "3.0.8", | ||
"lodash.isobject": "3.0.2", | ||
"lodash.isstring": "4.0.1", | ||
"lodash.isundefined": "3.0.1", | ||
"machine": "~12.1.0", | ||
@@ -18,0 +22,0 @@ "machinepack-json": "~2.0.0", |
@@ -32,3 +32,3 @@ { | ||
"using": { | ||
"command": "ls -la ./", | ||
"command": "sleep 1", | ||
"environmentVars": { | ||
@@ -35,0 +35,0 @@ "NODE_ENV": "production" |
27722
567
7
+ Addedlodash.isfunction@3.0.8
+ Addedlodash.isobject@3.0.2
+ Addedlodash.isstring@4.0.1
+ Addedlodash.isundefined@3.0.1
+ Addedlodash.isobject@3.0.2(transitive)
+ Addedlodash.isstring@4.0.1(transitive)
+ Addedlodash.isundefined@3.0.1(transitive)