mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
inspector: check if connected before waiting
Fixes: https://github.com/nodejs/node/issues/10093 PR-URL: https://github.com/nodejs/node/pull/10094 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
19d7197177
commit
b41db3396b
|
|
@ -548,10 +548,12 @@ bool AgentImpl::IsStarted() {
|
|||
}
|
||||
|
||||
void AgentImpl::WaitForDisconnect() {
|
||||
shutting_down_ = true;
|
||||
fprintf(stderr, "Waiting for the debugger to disconnect...\n");
|
||||
fflush(stderr);
|
||||
inspector_->runMessageLoopOnPause(0);
|
||||
if (state_ == State::kConnected) {
|
||||
shutting_down_ = true;
|
||||
fprintf(stderr, "Waiting for the debugger to disconnect...\n");
|
||||
fflush(stderr);
|
||||
inspector_->runMessageLoopOnPause(0);
|
||||
}
|
||||
}
|
||||
|
||||
#define READONLY_PROPERTY(obj, str, var) \
|
||||
|
|
|
|||
15
test/inspector/test-inspector-stops-no-file.js
Normal file
15
test/inspector/test-inspector-stops-no-file.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
'use strict';
|
||||
require('../common');
|
||||
const spawn = require('child_process').spawn;
|
||||
|
||||
const child = spawn(process.execPath,
|
||||
[ '--inspect', 'no-such-script.js' ],
|
||||
{ 'stdio': 'inherit' });
|
||||
|
||||
function signalHandler(value) {
|
||||
child.kill();
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
process.on('SIGINT', signalHandler);
|
||||
process.on('SIGTERM', signalHandler);
|
||||
Loading…
Reference in New Issue
Block a user