Windows 0.9.0: `conhost --headless` exits at once when stdin is "ignore", so the adb server (and emulators) never start

未关闭
#1,920 9 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@V3RON 已经在做这个了。

开始于 2026年11月30日。

  • #1958 来自 @V3RON —— 未关闭

评估

难度
3/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
领域
backend, mobile

调研方向

Start by reading dist/ports/windows-command.js and the childStdio logic in dist/ports/node-process-runner.js; the issue reproduces the behavior with child_process.spawn. Check the Android emulator launch in dist/drivers/android/emulator.js too, since it uses the same wrapper. Reproduce with stdin set to ignore and pipe, then verify adb and the emulator stay running with file logging.

由索引模型根据 Issue 内容生成。

描述

bug:blocked os:windows platform:android

On a Windows worker, 0.9.0 never starts its adb server, so the Android driver is skipped and the worker offers no Android devices. It worked on the same machine with 0.8.0.

"module":"daemon.driver-discovery","message":"Skipped Android driver: adb server unavailable",
"fields":{"port":5038,"reason":"start-failed","summary":"Refusing to run the android driver: Simlock's adb server did not start listening on port 5038 within 10000ms"}

simlock catalog then prints No platforms available., and ~\.simlock\logs\adb-server.log holds only conhost's title escape sequence (ESC]0;C:\Windows\System32\conhost.exe).

Seen on Windows 11 (Windows_NT 10.0.26300 x64), Simlock 0.9.0, agent-device 0.21.44, SDK platform-tools 37.0.0, emulator 36.5.11, worker started by the logon scheduled task (simlock daemon start) and joined to a gateway.

Why

A child with outlivesCaller: true is wrapped by headlessLaunch (dist/ports/windows-command.js) as conhost.exe --headless <command> ...args (ADR 0086, #1759). A child that logs to a file gets stdio: ["ignore", logFd, logFd] (childStdio in dist/ports/node-process-runner.js). With stdin set to ignore, conhost.exe --headless exits immediately (exit 0) without ever starting the program it was given. The adb server is launched this way, so it never listens, and the driver gives up after 10 s.

The emulator is launched the same way (dist/drivers/android/emulator.js, outlivesCaller: true, stdio: { file: logPath }), so fixing only the adb launch would move the failure to emulator boot.

Reproduction

Node child_process.spawn with the same options Simlock uses:

  • conhost.exe --headless <sdk>\platform-tools\adb.exe -P 5038 nodaemon server, stdio: ["ignore", fd, fd]: exits 0 after ~31 ms, nothing listens on 5038, and the log holds only the conhost escape sequence (byte for byte what the worker's adb-server.log holds).
  • Same adb, spawned directly with the same stdio: listening on 127.0.0.1:5038 after ~112 ms.
  • conhost.exe --headless cmd.exe /c "echo hi && ping -n 2 127.0.0.1": with stdin ignore, exits 0 after ~23 ms with no output; with stdin pipe, runs ~1 s and prints hi.

Port 5038 was free and in no excluded port range; another (unrelated) adb server on 5037 plays no part.

Possible fix

Give the wrapped child a stdin that stays open (for example "pipe", left unwritten) whenever headlessLaunch applies, or skip the conhost wrapper for children that log to a file.

主要语言
TypeScript
星标
730
派生
44
平均合并
16 小时 13 分钟
30 天内合并 PR
387

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

callstackincubator/simlock 的其他 Issue

查看 callstackincubator/simlock 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。