MCPcopy
hub / github.com/expressjs/generator / exit

Function exit

bin/express-cli.js:392–412  ·  view source on GitHub ↗

* Graceful exit for async STDIO

(code)

Source from the content-addressed store, hash-verified

390 */
391
392function exit (code) {
393 // flush output for Node.js Windows pipe bug
394 // https://github.com/joyent/node/issues/6247 is just one bug example
395 // https://github.com/visionmedia/mocha/issues/333 has a good discussion
396 function done () {
397 if (!(draining--)) _exit(code)
398 }
399
400 var draining = 0
401 var streams = [process.stdout, process.stderr]
402
403 exit.exited = true
404
405 streams.forEach(function (stream) {
406 // submit empty write request and wait for completion
407 draining += 1
408 stream.write('', done)
409 })
410
411 done()
412}
413
414/**
415 * Determine if launched from cmd.exe

Callers 1

mainFunction · 0.85

Calls 1

doneFunction · 0.85

Tested by

no test coverage detected