exchange deleteSession and curCommandCancellable
session should be closed firstly if some unexpected happens, so the following request can be responsed immediately.
MODIFY
lib/basedriver/driver.js
lib/basedriver/driver.js
@@ -236,10 +236,10 @@ class BaseDriver extends MobileJsonWireProtocol {
async startUnexpectedShutdown (err = new errors.NoSuchDriverError('The driver was unexpectedly shut down!')) {
this.unexpectedShutdownDeferred.reject(err); // allow others to listen for this
- this.curCommandCancellable.cancel(err);
this.shutdownUnexpectedly = true;
await this.deleteSession(this.sessionId);
this.shutdownUnexpectedly = false;
+ this.curCommandCancellable.cancel(err);
}
validateLocatorStrategy (strategy, webContext = false) {

exchange deleteSession and curCommandCancellable (#126)

session should be closed firstly if some unexpected happens, so the following request can be responsed immediately.