Skip to content

Commit b41db33

Browse files
Eugene OstroukhovFishrock123
Eugene Ostroukhov
authored andcommitted
inspector: check if connected before waiting
Fixes: #10093 PR-URL: #10094 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 19d7197 commit b41db33

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

src/inspector_agent.cc

+6-4
Original file line numberDiff line numberDiff line change
@@ -548,10 +548,12 @@ bool AgentImpl::IsStarted() {
548548
}
549549

550550
void AgentImpl::WaitForDisconnect() {
551-
shutting_down_ = true;
552-
fprintf(stderr, "Waiting for the debugger to disconnect...\n");
553-
fflush(stderr);
554-
inspector_->runMessageLoopOnPause(0);
551+
if (state_ == State::kConnected) {
552+
shutting_down_ = true;
553+
fprintf(stderr, "Waiting for the debugger to disconnect...\n");
554+
fflush(stderr);
555+
inspector_->runMessageLoopOnPause(0);
556+
}
555557
}
556558

557559
#define READONLY_PROPERTY(obj, str, var) \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use strict';
2+
require('../common');
3+
const spawn = require('child_process').spawn;
4+
5+
const child = spawn(process.execPath,
6+
[ '--inspect', 'no-such-script.js' ],
7+
{ 'stdio': 'inherit' });
8+
9+
function signalHandler(value) {
10+
child.kill();
11+
process.exit(1);
12+
}
13+
14+
process.on('SIGINT', signalHandler);
15+
process.on('SIGTERM', signalHandler);

0 commit comments

Comments
 (0)