ohos-playwright 0.2.11 → 0.2.13
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/dist/setup.mjs +8 -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 "
|
|
59
|
-
const
|
|
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() {
|