Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"coverage": "istanbul cover test/*.test.js && open ./coverage/lcov-report/index.html"
},
"devDependencies": {
"async": "^2.6.0",
"istanbul": "^0.4.5",
"json-stringify-safe": "^5.0.1",
"pre-commit": "^1.1.3",
Expand Down
21 changes: 19 additions & 2 deletions shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,31 @@ module.exports = function (hardExit) {
var commands


function shellOnExitCommand (command, system, cb) {
cb = cb || function () {}
return cmds.shell(command, system, cb)
}

function stopSystem (args, system, cb) {
var onExitCommand = system.global.onExit || false
runner.stopAll(system, function () {
if (dns) { dns.stop() }
if (morp) { morp.stop() }
if (hardExit) {
process.exit(0)
if (onExitCommand) {
return shellOnExitCommand(onExitCommand, system, function () {
process.exit(0)
})
}
return process.exit(0)
} else {
cb && cb()
if (onExitCommand && cb) {
return shellOnExitCommand(onExitCommand, system, cb)
} else if (onExitCommand && !cb) {
return shellOnExitCommand(onExitCommand, system)
} else if (cb) {
cb()
}
}
})
}
Expand Down