2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2010-12-05 00:20:34 +01:00
|
|
|
var common = require('../common');
|
|
|
|
var assert = require('assert');
|
2010-09-07 16:38:43 +02:00
|
|
|
|
2010-12-05 20:15:30 +01:00
|
|
|
process.on('uncaughtException', function(err) {
|
2010-08-30 21:02:01 +02:00
|
|
|
console.log('Caught exception: ' + err);
|
|
|
|
});
|
|
|
|
|
2010-09-07 16:38:43 +02:00
|
|
|
var timeoutFired = false;
|
2010-12-05 20:15:30 +01:00
|
|
|
setTimeout(function() {
|
2010-08-30 21:02:01 +02:00
|
|
|
console.log('This will still run.');
|
2010-09-07 16:38:43 +02:00
|
|
|
timeoutFired = true;
|
2010-08-30 21:02:01 +02:00
|
|
|
}, 500);
|
|
|
|
|
2010-09-07 16:38:43 +02:00
|
|
|
process.on('exit', function() {
|
|
|
|
assert.ok(timeoutFired);
|
|
|
|
});
|
|
|
|
|
2010-08-30 21:02:01 +02:00
|
|
|
// Intentionally cause an exception, but don't catch it.
|
|
|
|
nonexistentFunc();
|
|
|
|
console.log('This will not run.');
|
2010-09-07 16:38:43 +02:00
|
|
|
|