nuclide-commons
Advanced tools
Comparing version 0.0.14 to 0.0.15
@@ -54,2 +54,6 @@ 'use babel'; | ||
get paths() { | ||
return require('./paths'); | ||
}, | ||
get PromiseQueue() { | ||
@@ -56,0 +60,0 @@ return require('./PromiseQueue'); |
@@ -22,4 +22,20 @@ 'use babel'; | ||
function copyProperties(src: Object, dest: Object): void { | ||
for (var key in src) { | ||
dest[key] = src[key]; | ||
} | ||
} | ||
/** | ||
* Modeled after Object.assign(): | ||
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign | ||
*/ | ||
function assign(target: Object, ...sources: Array<Object>): Object { | ||
sources.forEach(source => copyProperties(source, target)); | ||
return target; | ||
} | ||
module.exports = { | ||
assign, | ||
isEmpty, | ||
}; |
@@ -63,5 +63,9 @@ 'use babel'; | ||
* stdin string The contents to write to stdin. | ||
* pipedCommand string a command to pipe the output of command through. | ||
* pipedArgs array of strings as arguments. | ||
* @return Promise that resolves to an object with the properties: | ||
* stdout string The contents of the process's output stream. | ||
* stderr string The contents of the process's error stream. | ||
* stdout string The contents of the process's output stream. (If this exceeds the maxBuffer, | ||
* then this Promise will reject.) | ||
* stderr string The contents of the process's error stream. (If this exceeds the maxBuffer, | ||
* then this Promise will reject.) | ||
* exitCode number The exit code returned by the process. | ||
@@ -72,5 +76,15 @@ */ | ||
args: Array<string>, | ||
options: ?any = {}): Promise { | ||
options: any = {}): Promise { | ||
var {commandString, commandStringWithArgs} = createCommand(command, args); | ||
if (options && options.pipedCommand) { | ||
var { | ||
commandString: pipedCommandString, | ||
commandStringWithArgs: pipedCommandStringWithArgs, | ||
} = createCommand(options.pipedCommand, options.pipedArgs || []); | ||
commandString += '|' + pipedCommandString; | ||
commandStringWithArgs += '|' + pipedCommandStringWithArgs; | ||
} | ||
// Add commons binary paths to the PATH when no custom env provided. | ||
@@ -89,5 +103,9 @@ options.env = options.env || createExecEnvironment(process.env, COMMON_BINARY_PATHS); | ||
var exitCode = error ? error.code : 0; | ||
// If there is an internal error, such as "stdout maxBuffer exceeded.", | ||
// then there will not be an exitCode, but there will be an errorMessage. | ||
var errorMessage = error ? error.message : null; | ||
var result = { | ||
stdout, | ||
stderr, | ||
errorMessage, | ||
exitCode, | ||
@@ -94,0 +112,0 @@ command: commandStringWithArgs, |
@@ -5,3 +5,3 @@ { | ||
"mkdirp": "0.5.0", | ||
"nuclide-node-transpiler": "0.0.14", | ||
"nuclide-node-transpiler": "0.0.15", | ||
"rimraf": "2.2.8", | ||
@@ -25,3 +25,3 @@ "shell-escape": "0.2.0", | ||
}, | ||
"version": "0.0.14" | ||
"version": "0.0.15" | ||
} |
45900
27
1383
+ Addednuclide-node-transpiler@0.0.15(transitive)
- Removednuclide-node-transpiler@0.0.14(transitive)