@@ -6,6 +6,7 @@ const net = require('net');
6
6
const dgram = require ( 'dgram' ) ;
7
7
const assert = require ( 'assert' ) ;
8
8
const util = require ( 'util' ) ;
9
+ const debug = util . debuglog ( 'child_process' ) ;
9
10
10
11
const Process = process . binding ( 'process_wrap' ) . Process ;
11
12
const WriteWrap = process . binding ( 'stream_wrap' ) . WriteWrap ;
@@ -958,6 +959,8 @@ var spawn = exports.spawn = function(/*file, args, options*/) {
958
959
var options = opts . options ;
959
960
var child = new ChildProcess ( ) ;
960
961
962
+ debug ( 'spawn' , opts . args , options ) ;
963
+
961
964
child . spawn ( {
962
965
file : opts . file ,
963
966
args : opts . args ,
@@ -1035,6 +1038,7 @@ function ChildProcess() {
1035
1038
if ( self . spawnfile )
1036
1039
err . path = self . spawnfile ;
1037
1040
1041
+ err . spawnargs = self . spawnargs . slice ( 1 ) ;
1038
1042
self . emit ( 'error' , err ) ;
1039
1043
} else {
1040
1044
self . emit ( 'exit' , self . exitCode , self . signalCode ) ;
@@ -1097,6 +1101,7 @@ ChildProcess.prototype.spawn = function(options) {
1097
1101
}
1098
1102
1099
1103
this . spawnfile = options . file ;
1104
+ this . spawnargs = options . args ;
1100
1105
1101
1106
var err = this . _handle . spawn ( options ) ;
1102
1107
@@ -1242,6 +1247,8 @@ function spawnSync(/*file, args, options*/) {
1242
1247
1243
1248
var i ;
1244
1249
1250
+ debug ( 'spawnSync' , opts . args , options ) ;
1251
+
1245
1252
options . file = opts . file ;
1246
1253
options . args = opts . args ;
1247
1254
options . envPairs = opts . envPairs ;
@@ -1289,8 +1296,11 @@ function spawnSync(/*file, args, options*/) {
1289
1296
result . stdout = result . output && result . output [ 1 ] ;
1290
1297
result . stderr = result . output && result . output [ 2 ] ;
1291
1298
1292
- if ( result . error )
1293
- result . error = errnoException ( result . error , 'spawnSync' ) ;
1299
+ if ( result . error ) {
1300
+ result . error = errnoException ( result . error , 'spawnSync ' + opts . file ) ;
1301
+ result . error . path = opts . file ;
1302
+ result . error . spawnargs = opts . args . slice ( 1 ) ;
1303
+ }
1294
1304
1295
1305
util . _extend ( result , opts ) ;
1296
1306
0 commit comments