@frockbot/computer-host-runtime 0.3.14 → 0.3.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frockbot/computer-host-runtime",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -1340,6 +1340,12 @@ describe("box-doctor", () => {
1340
1340
  expect(boxDoctorScript).toContain('"webdriver":true');
1341
1341
  });
1342
1342
 
1343
+ test("counts only the browser main process", () => {
1344
+ expect(boxDoctorScript).toContain(
1345
+ `BROWSERS=$(pgrep -af -- "--user-data-dir=[/]home/box/chrome-profile" 2>/dev/null | awk -v self="$$" -v parent="$PPID" '$1 != self && $1 != parent && $0 ~ /(^|\\/)chrom(e|ium)( |$)/ && $0 !~ /(^|[[:space:]])--type=/ { count++ } END { print count + 0 }')`,
1346
+ );
1347
+ });
1348
+
1343
1349
  test("reports the scratch, the launcher, and the reference version it expects", () => {
1344
1350
  expect(boxDoctorScript).toContain(SCRATCH_ROOT);
1345
1351
  expect(boxDoctorScript).toContain(CHROME_LAUNCHER);
package/src/runtime.ts CHANGED
@@ -1770,7 +1770,7 @@ if [ -n "$KEY" ] && [ -s ${BOTS_ROOT}/"$KEY"/slot ]; then SLOT=$(cat ${BOTS_ROOT
1770
1770
  # second browser holding — or failing to hold — the one shared profile, which
1771
1771
  # is the defect this layout replaced: the loser prints "Opening in existing
1772
1772
  # browser session", exits, and leaves its Bot a black screen.
1773
- BROWSERS=$(pgrep -f -- "--remote-debugging-port=${COMPUTER_CDP_PORT}" 2>/dev/null | wc -l | tr -d ' ')
1773
+ BROWSERS=$(pgrep -af -- "--user-data-dir=${CHROME_PROFILE.replace("/", "[/]")}" 2>/dev/null | awk -v self="$$" -v parent="$PPID" '$1 != self && $1 != parent && $0 ~ /(^|\\/)chrom(e|ium)( |$)/ && $0 !~ /(^|[[:space:]])--type=/ { count++ } END { print count + 0 }')
1774
1774
  if [ "$BROWSERS" = 1 ]; then
1775
1775
  record browser-process pass "exactly one browser process holds ${CHROME_PROFILE}"
1776
1776
  elif [ "$BROWSERS" = 0 ]; then