Skip to content

Commit 0aac889

Browse files
committed
more process exit cleanup
1 parent 5c21a9d commit 0aac889

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

server.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -245,25 +245,28 @@ function mount_dav(server) {
245245
winston.info('webdav filesystem mounted');
246246
}
247247

248-
process.on('SIGINT', function() {
249-
winston.info("\nShutting down from SIGINT");
250-
console.log(terminals);
251-
248+
function cleanup() {
249+
winston.info("process and worker cleanup");
252250
Object.keys(terminals).forEach(function (pid) {
253251
var term = terminals[pid];
254252
console.log('Closed terminal ' + term.pid);
255253
term.kill();
256254
});
257255

258-
// some other closing procedures go here
259256
debug_helper.kill_debug(false, function() {
260257
//no need to wait for this
261258
});
259+
}
260+
261+
process.on('SIGINT', function() {
262+
winston.info("Shutting down from SIGINT");
263+
cleanup();
262264
process.exit();
263265
});
264266

265-
// process.on('uncaughtException', function(err) {
266-
// debug_helper.kill_debug(false, function() {
267-
// //no need to wait for this
268-
// });
269-
// });
267+
process.on('uncaughtException', function(err) {
268+
winston.error("Shutting down from uncaughtException");
269+
winston.error(err.stack);
270+
cleanup();
271+
process.exit();
272+
});

0 commit comments

Comments
 (0)