This is an automated email from the ASF dual-hosted git repository. alexkli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/openwhisk-wskdebug.git
commit cd50058d8b5e946aa64e4407dc57666b0283a94c Author: Alexander Klimetschek <[email protected]> AuthorDate: Sat Mar 28 23:53:31 2020 -0700 guard this.* access in Debugger.shutdown()/stop()/kill() --- src/debugger.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/debugger.js b/src/debugger.js index e43c8e8..fc24b11 100644 --- a/src/debugger.js +++ b/src/debugger.js @@ -161,7 +161,9 @@ class Debugger { async stop() { this.running = false; - this.agentMgr.stop(); + if (this.agentMgr) { + this.agentMgr.stop(); + } if (this.runPromise) { // wait for the main loop to gracefully end, which will call shutdown() @@ -174,7 +176,9 @@ class Debugger { async kill() { this.running = false; - this.agentMgr.stop(); + if (this.agentMgr) { + this.agentMgr.stop(); + } await this.shutdown(); } @@ -189,9 +193,15 @@ class Debugger { // need to shutdown everything even if some fail, hence tryCatch() for each - await this.tryCatch(this.agentMgr.shutdown()); - await this.tryCatch(this.invoker.stop()); - await this.tryCatch(this.watcher.stop()); + if (this.agentMgr) { + await this.tryCatch(this.agentMgr.shutdown()); + } + if (this.invoker) { + await this.tryCatch(this.invoker.stop()); + } + if (this.watcher) { + await this.tryCatch(this.watcher.stop()); + } // only log this if we started properly if (this.ready) {
