Skip to content
This repository was archived by the owner on Feb 1, 2022. It is now read-only.

Commit 360580e

Browse files
author
Jan Krems
committed
feat: Add run/kill/restart
1 parent 7064cce commit 360580e

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

lib/node-inspect.js

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,18 @@ function createCommandContext(inspector) {
664664
if (verbose) print('');
665665
});
666666
},
667+
668+
get run() {
669+
return inspector.run();
670+
},
671+
672+
get kill() {
673+
return inspector.killChild();
674+
},
675+
676+
get restart() {
677+
return inspector.restart();
678+
},
667679
};
668680

669681
Debugger.on('paused', ({ callFrames, reason /* , hitBreakpoints */ }) => {
@@ -911,6 +923,18 @@ class Inspector {
911923
// }
912924

913925

926+
restart() {
927+
this.pause();
928+
this.killChild();
929+
930+
// XXX need to wait a little bit for the restart to work?
931+
setTimeout(() => {
932+
this.trySpawn();
933+
this.resume();
934+
}, 1000);
935+
}
936+
937+
914938
// Run script
915939
run(callback) {
916940
if (this.child) {
@@ -936,9 +960,6 @@ class Inspector {
936960
}
937961

938962
if (this.client) {
939-
// Save breakpoints
940-
this.breakpoints = this.client.breakpoints;
941-
942963
this.client.destroy();
943964
this.client = null;
944965
}

0 commit comments

Comments
 (0)