-
Notifications
You must be signed in to change notification settings - Fork 982
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backport #1024: add server option to disable the uncaughtException ha…
…ndler
- Loading branch information
Showing
6 changed files
with
111 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// A simple node process that will start a restify server with the | ||
// uncaughtException handler disabled. Responds to a 'serverPortRequest' message | ||
// and sends back the server's bound port number. | ||
|
||
'use strict'; | ||
|
||
var restify = require('../../lib'); | ||
|
||
function main() { | ||
var port = process.env.UNIT_TEST_PORT || 0; | ||
var server = restify.createServer({ handleUncaughtExceptions: false }); | ||
server.get('/', function (req, res, next) { | ||
throw new Error('Catch me!'); | ||
}); | ||
server.listen(0, function () { | ||
port = server.address().port; | ||
console.log('port: ', port); | ||
|
||
process.on('message', function (msg) { | ||
if (msg.task !== 'serverPortRequest') { | ||
process.send({error: 'Unexpected message: ' + msg}); | ||
return; | ||
} | ||
process.send({task: 'serverPortResponse', port: port}); | ||
}); | ||
}); | ||
} | ||
|
||
if (require.main === module) { | ||
main(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters