@wdio/appium-service 9.5.0 → 9.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -4,8 +4,8 @@ import fs from "node:fs";
4
4
  import fsp from "node:fs/promises";
5
5
  import url from "node:url";
6
6
  import path from "node:path";
7
- import treeKill from "tree-kill";
8
7
  import { spawn } from "node:child_process";
8
+ import { promisify } from "node:util";
9
9
  import logger from "@wdio/logger";
10
10
  import getPort from "get-port";
11
11
  import { resolve as resolve2 } from "import-meta-resolve";
@@ -48,6 +48,7 @@ function sanitizeCliOptionValue(value) {
48
48
  }
49
49
 
50
50
  // src/launcher.ts
51
+ import treeKill from "tree-kill";
51
52
  var log = logger("@wdio/appium-service");
52
53
  var DEFAULT_APPIUM_PORT = 4723;
53
54
  var DEFAULT_LOG_FILENAME = "wdio-appium.log";
@@ -104,7 +105,7 @@ var AppiumLauncher = class _AppiumLauncher {
104
105
  );
105
106
  }
106
107
  }
107
- return;
108
+ return capabilityWasUpdated;
108
109
  }
109
110
  this._capabilities.forEach((cap) => {
110
111
  const w3cCap = cap;
@@ -162,18 +163,28 @@ var AppiumLauncher = class _AppiumLauncher {
162
163
  #logStderr = (data) => {
163
164
  log.warn(data.toString());
164
165
  };
165
- onComplete() {
166
+ promisifiedTreeKill = promisify(treeKill);
167
+ async onComplete() {
166
168
  this._isShuttingDown = true;
167
169
  if (this._process && this._process.pid) {
168
170
  this._process.stdout.off("data", this.#logStdout);
169
171
  this._process.stderr.off("data", this.#logStderr);
170
172
  log.info("Killing entire Appium tree");
171
- treeKill(this._process.pid, "SIGTERM", (err) => {
172
- if (err) {
173
- return log.warn("Failed to kill process:", err);
174
- }
173
+ try {
174
+ await this.promisifiedTreeKill(this._process.pid, "SIGTERM").catch(async (err) => {
175
+ log.warn("SIGTERM failed, attempting SIGKILL:", err);
176
+ await this.promisifiedTreeKill(this._process.pid, "SIGKILL");
177
+ });
175
178
  log.info("Process and its children successfully terminated");
176
- });
179
+ } catch (err) {
180
+ log.error("Failed to kill Appium process tree:", err);
181
+ try {
182
+ this._process.kill("SIGKILL");
183
+ log.info("Killed main process directly");
184
+ } catch (e) {
185
+ log.error("Failed to kill process directly:", e);
186
+ }
187
+ }
177
188
  }
178
189
  }
179
190
  _startAppium(command, args, timeout = APPIUM_START_TIMEOUT) {
@@ -196,7 +207,9 @@ var AppiumLauncher = class _AppiumLauncher {
196
207
  };
197
208
  const onErrorMessage = (data) => {
198
209
  error = data.toString() || "Appium exited without unknown error message";
199
- log.error(error);
210
+ if (!data.toString().includes("Debugger attached")) {
211
+ log.error(error);
212
+ }
200
213
  rejectOnce(new Error(error));
201
214
  };
202
215
  const onStdout = (data) => {
@@ -18,7 +18,8 @@ export default class AppiumLauncher implements Services.ServiceInstance {
18
18
  */
19
19
  private _setCapabilities;
20
20
  onPrepare(): Promise<void>;
21
- onComplete(): void;
21
+ private promisifiedTreeKill;
22
+ onComplete(): Promise<void>;
22
23
  private _startAppium;
23
24
  private _redirectLogStream;
24
25
  private static _getAppiumCommand;
@@ -1 +1 @@
1
- {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAIlE,OAAO,KAAK,EAAyB,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAY5E,MAAM,CAAC,OAAO,OAAO,cAAe,YAAW,QAAQ,CAAC,eAAe;;IAQ/D,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,OAAO,CAAC;IATpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAQ;IAClC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAe;IAC9C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAuB;IAC7C,OAAO,CAAC,QAAQ,CAAC,CAA+C;IAChE,OAAO,CAAC,eAAe,CAAiB;gBAG5B,QAAQ,EAAE,mBAAmB,EAC7B,aAAa,EAAE,YAAY,CAAC,sBAAsB,EAClD,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,YAAA;YAS1B,WAAW;IAqBzB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAyDlB,SAAS;IAqDf,UAAU;IA0BV,OAAO,CAAC,YAAY;YA6EN,kBAAkB;mBAeX,iBAAiB;CAezC"}
1
+ {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAIlE,OAAO,KAAK,EAAyB,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAa5E,MAAM,CAAC,OAAO,OAAO,cAAe,YAAW,QAAQ,CAAC,eAAe;;IAQ/D,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,OAAO,CAAC;IATpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAQ;IAClC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAe;IAC9C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAuB;IAC7C,OAAO,CAAC,QAAQ,CAAC,CAA+C;IAChE,OAAO,CAAC,eAAe,CAAiB;gBAG5B,QAAQ,EAAE,mBAAmB,EAC7B,aAAa,EAAE,YAAY,CAAC,sBAAsB,EAClD,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,YAAA;YAS1B,WAAW;IAqBzB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAyDlB,SAAS;IAqDf,OAAO,CAAC,mBAAmB,CAAsC;IAC3D,UAAU;IAmChB,OAAO,CAAC,YAAY;YAkFN,kBAAkB;mBAeX,iBAAiB;CAezC"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAIxD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAU9E;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,EAAE,CAwB1D;AAED,wBAAgB,sBAAsB,CAAE,KAAK,EAAE,QAAQ,UAItD;AAED,wBAAgB,SAAS,IAAI,OAAO,CAEnC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAIxD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAU9E;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,EAAE,CAwB1D;AAED,wBAAgB,sBAAsB,CAAE,KAAK,EAAE,QAAQ,UAItD;AAED,wBAAgB,SAAS,IAAI,OAAO,CAEnC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/appium-service",
3
- "version": "9.5.0",
3
+ "version": "9.5.2",
4
4
  "description": "A WebdriverIO service to start & stop Appium Server",
5
5
  "author": "Morten Bjerg Gregersen <morten@mogee.dk>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-appium-service",
@@ -43,10 +43,10 @@
43
43
  "get-port": "^7.0.0",
44
44
  "import-meta-resolve": "^4.0.0",
45
45
  "tree-kill": "^1.2.2",
46
- "webdriverio": "9.5.0"
46
+ "webdriverio": "9.5.2"
47
47
  },
48
48
  "publishConfig": {
49
49
  "access": "public"
50
50
  },
51
- "gitHead": "379782cd89707c184a038d6702b46b852817803a"
51
+ "gitHead": "5dac7f9da53631945d6b8c7cc10a5550623dd6eb"
52
52
  }