ohos-playwright 0.2.11 → 0.2.12

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.
Files changed (2) hide show
  1. package/dist/setup.mjs +8 -2
  2. package/package.json +1 -1
package/dist/setup.mjs CHANGED
@@ -54,9 +54,15 @@ export async function retry(fn, { max = 10, interval = 1000, label = '' } = {})
54
54
  }
55
55
  // Batch ps + /proc/net/unix into a single hdc shell call — avoids two
56
56
  // subprocess spawns and transfers.
57
+ // Separator uses shell $$ (device shell PID) so the echo output is a numeric
58
+ // string like "OHOS_SEP_12345". The hdc process itself is visible in ps with
59
+ // literal "$$" in its args — no collision with the actual separator value.
57
60
  function fetchDeviceState() {
58
- const raw = shellOnDevice('ps -o pid,args; echo "---SOCKET---"; cat /proc/net/unix');
59
- const [ps, unix] = raw.split('---SOCKET---');
61
+ const raw = shellOnDevice('ps -o pid,args; echo "OHOS_SEP_$$"; cat /proc/net/unix');
62
+ const sepMatch = raw.match(/OHOS_SEP_\d+/);
63
+ if (!sepMatch)
64
+ return { ps: raw, unix: '' };
65
+ const [ps, unix] = raw.split(sepMatch[0]);
60
66
  return { ps: ps || '', unix: unix || '' };
61
67
  }
62
68
  export function findBrowserPid() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ohos-playwright",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "Playwright adapter for OpenHarmony / ArkWeb via hdc + CDP",
5
5
  "license": "MIT",
6
6
  "author": "social4hyq",