Revision 75df612c

View differences:

doc/api/child_process.markdown
41 41

  
42 42
### Event: 'close'
43 43

  
44
* `code` {Number} the exit code, if it exited normally.
45
* `signal` {String} the signal passed to kill the child process, if it
46
  was killed by the parent.
47

  
44 48
This event is emitted when the stdio streams of a child process have all
45 49
terminated.  This is distinct from 'exit', since multiple processes
46 50
might share the same stdio streams.
......
112 116
    var spawn = require('child_process').spawn,
113 117
        grep  = spawn('grep', ['ssh']);
114 118

  
115
    grep.on('exit', function (code, signal) {
119
    grep.on('close', function (code, signal) {
116 120
      console.log('child process terminated due to receipt of signal '+signal);
117 121
    });
118 122

  
......
279 283
      console.log('stderr: ' + data);
280 284
    });
281 285

  
282
    ls.on('exit', function (code) {
286
    ls.on('close', function (code) {
283 287
      console.log('child process exited with code ' + code);
284 288
    });
285 289

  
......
298 302
      console.log('ps stderr: ' + data);
299 303
    });
300 304

  
301
    ps.on('exit', function (code) {
305
    ps.on('close', function (code) {
302 306
      if (code !== 0) {
303 307
        console.log('ps process exited with code ' + code);
304 308
      }
......
313 317
      console.log('grep stderr: ' + data);
314 318
    });
315 319

  
316
    grep.on('exit', function (code) {
320
    grep.on('close', function (code) {
317 321
      if (code !== 0) {
318 322
        console.log('grep process exited with code ' + code);
319 323
      }

Also available in: Unified diff