cross-spawn-cb 0.5.15 → 0.6.0

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.
@@ -33,21 +33,16 @@ module.exports = function spawnCallback(command, args, options, callback) {
33
33
  if (stderr) stderr = Buffer.concat(stderr);
34
34
 
35
35
  // format results - string
36
- var encoding = options.encoding === 'buffer' ? 'utf8' : options.encoding || 'utf8';
37
- if ((options.encoding && options.encoding !== 'buffer') || options.stdio === 'string') {
38
- stdout = stdout.toString(encoding);
39
- stderr = stderr.toString(encoding);
40
- } else if (options.stdout === 'string') {
41
- stdout = stdout.toString(encoding);
42
- } else if (options.stderr === 'string') {
43
- stderr = stderr.toString(encoding);
36
+ if ((options.encoding && options.encoding !== 'buffer')) {
37
+ stdout = stdout.toString(options.encoding);
38
+ stderr = stderr.toString(options.encoding);
44
39
  }
45
40
 
46
41
  // process errors
47
42
  var err = status !== 0 ? new Error('Non-zero exit code: ' + status) : null;
48
43
  if (stderr && stderr.length) {
49
44
  err = err || new Error('stderr has content');
50
- err.stderr = stderr;
45
+ err.stderr = Buffer.isBuffer(stderr) ? stderr.toString('utf8') : stderr;
51
46
  }
52
47
  if (err) return callback(err);
53
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cross-spawn-cb",
3
- "version": "0.5.15",
3
+ "version": "0.6.0",
4
4
  "description": "Cross spawn with a completion callback",
5
5
  "keywords": [
6
6
  "cross-spawn",