release v2.0.17:终端 pty 排查结论落盘(docs/termux-pty-调查.md)+ 清掉诊断候选

This commit is contained in:
l
2026-10-13 10:24:32 +08:00
parent d88a7aa8aa
commit 52feef35cd
4 changed files with 124 additions and 3 deletions

View File

@@ -101,6 +101,9 @@ public final class TerminalSession extends TerminalOutput {
/** Inform the attached pty of the new size and reflow or initialize the emulator. */
public void updateSize(int columns, int rows, int cellWidthPixels, int cellHeightPixels) {
android.util.Log.i("DoubaoTermux", "updateSize cols=" + columns + " rows=" + rows
+ " cell=" + cellWidthPixels + "x" + cellHeightPixels
+ " emulator=" + (mEmulator != null));
if (mEmulator == null) {
initializeEmulator(columns, rows, cellWidthPixels, cellHeightPixels);
} else {
@@ -127,6 +130,15 @@ public final class TerminalSession extends TerminalOutput {
mTerminalFileDescriptor = JNI.createSubprocess(mShellPath, mCwd, mArgs, mEnv, processId, rows, columns, cellWidthPixels, cellHeightPixels);
mShellPid = processId[0];
// ★ 诊断日志:这一行是判断 pty 到底建成什么样的**唯一依据**。
// fd == -1 → /dev/ptmx 打开失败(或 grantpt/unlockpt 失败),
// 子进程的 0/1/2 全是无效 fd,bash 读 stdin 直接 EOF 退出。
// pid <= 0 → fork 失败。
// cols/rows 是 0 → attach 时 view 还没量过尺寸。
android.util.Log.i("DoubaoTermux", "createSubprocess -> fd=" + mTerminalFileDescriptor
+ " pid=" + mShellPid + " rows=" + rows + " cols=" + columns
+ " cell=" + cellWidthPixels + "x" + cellHeightPixels);
final FileDescriptor terminalFileDescriptorWrapped = wrapFileDescriptor(mTerminalFileDescriptor, mClient);
new Thread("TermSessionInputReader[pid=" + mShellPid + "]") {