cross-spawn-cb 0.5.14 → 0.5.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/spawnCallback.js +8 -5
- package/package.json +1 -1
package/lib/spawnCallback.js
CHANGED
|
@@ -28,16 +28,19 @@ module.exports = function spawnCallback(command, args, options, callback) {
|
|
|
28
28
|
});
|
|
29
29
|
cp.on('close', function (status, signal) {
|
|
30
30
|
nextTick(function closeNextTick() {
|
|
31
|
-
// format results
|
|
31
|
+
// format results - buffer
|
|
32
32
|
if (stdout) stdout = Buffer.concat(stdout);
|
|
33
33
|
if (stderr) stderr = Buffer.concat(stderr);
|
|
34
|
+
|
|
35
|
+
// format results - string
|
|
36
|
+
var encoding = options.encoding === 'buffer' ? 'utf8' : options.encoding || 'utf8';
|
|
34
37
|
if ((options.encoding && options.encoding !== 'buffer') || options.stdio === 'string') {
|
|
35
|
-
stdout = stdout.toString(
|
|
36
|
-
stderr = stderr.toString(
|
|
38
|
+
stdout = stdout.toString(encoding);
|
|
39
|
+
stderr = stderr.toString(encoding);
|
|
37
40
|
} else if (options.stdout === 'string') {
|
|
38
|
-
stdout = stdout.toString(
|
|
41
|
+
stdout = stdout.toString(encoding);
|
|
39
42
|
} else if (options.stderr === 'string') {
|
|
40
|
-
stderr = stderr.toString(
|
|
43
|
+
stderr = stderr.toString(encoding);
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
// process errors
|