src: fix stuck debugger process

The debug process running "node debug a.js" will be stuck when the
script ends. This is because the debug handler has been unrefed.
We shouldn't unref the debug handler to avoid this problem.

PR-URL: https://github.com/nodejs/node/pull/2778
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
Liang-Chi Hsieh authored and Ben Noordhuis committed 2015-10-13 12:58:36 +02:00
1 parent 6f14b3a7db
commit ff877e93e1
1 file changed
+4 -2
+4 -2
View File
@@ -3652,7 +3652,6 @@ void Init(int* argc,
uv_async_init(uv_default_loop(),
&dispatch_debug_messages_async,
DispatchDebugMessagesAsyncCallback);
uv_unref(reinterpret_cast<uv_handle_t*>(&dispatch_debug_messages_async));
#if defined(NODE_V8_OPTIONS)
// Should come before the call to V8::SetFlagsFromCommandLine()
@@ -3959,8 +3958,11 @@ static void StartNodeInstance(void* arg) {
env->set_trace_sync_io(trace_sync_io);
// Enable debugger
if (instance_data->use_debug_agent())
if (instance_data->use_debug_agent()) {
EnableDebug(env);
} else {
uv_unref(reinterpret_cast<uv_handle_t*>(&dispatch_debug_messages_async));
}
{
SealHandleScope seal(isolate);