Skip to content

Commit 98f22d8

Browse files
committed
test: fix hanging when testing with prepared core
When the session is created by loading a prepared core dump, it should delete the target before quitting otherwise the process will prompt about deleting it and will hang if it does not receive an answer.
1 parent c231a6b commit 98f22d8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/common.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ function Session(options) {
155155

156156
debug('lldb binary:', lldbBin);
157157
if (options.scenario) {
158-
this.needToKill = true;
158+
this.needToKill = true; // need to send 'kill' when quitting
159159
// lldb -- node scenario.js
160160
const args = [
161161
'--',
@@ -173,7 +173,7 @@ function Session(options) {
173173
this.lldb.stdin.write(`plugin load "${exports.llnodePath}"\n`);
174174
this.lldb.stdin.write('run\n');
175175
} else if (options.core) {
176-
this.needToKill = false;
176+
this.needToKill = false; // need to send 'target delete 0' when quitting
177177
debug('loading core', options.core);
178178
// lldb node -c core
179179
this.lldb = spawn(lldbBin, [], {
@@ -262,8 +262,11 @@ Session.prototype.kill = function kill() {
262262
};
263263

264264
Session.prototype.quit = function quit() {
265-
if (this.needToKill)
265+
if (this.needToKill) {
266266
this.send('kill'); // kill the process launched in lldb
267+
} else {
268+
this.send('target delete 0'); // Delete the loaded core dump
269+
}
267270

268271
this.send('quit');
269272
};

0 commit comments

Comments
 (0)