终端排查第四轮:找到根因——pty master 读 EIO(子进程标准流没接上从端);给被静默吞掉的异常加日志
This commit is contained in:
@@ -153,7 +153,9 @@ public final class TerminalSession extends TerminalOutput {
|
||||
mMainThreadHandler.sendEmptyMessage(MSG_NEW_INPUT);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Ignore, just shutting down.
|
||||
// ★ 原来是静默吞掉的(`// Ignore, just shutting down.`)——
|
||||
// 于是 fd 读失败时**一点线索都没有**。加上日志。
|
||||
android.util.Log.e("DoubaoTermux", "TermSessionInputReader 退出", e);
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
@@ -337,7 +339,15 @@ public final class TerminalSession extends TerminalOutput {
|
||||
}
|
||||
descriptorField.setAccessible(true);
|
||||
descriptorField.set(result, fileDescriptor);
|
||||
// ★ 诊断:反射到底成没成。
|
||||
// Android 9+ 对 java.* 私有成员的反射有隐藏 API 限制,
|
||||
// setAccessible 被拦的话 result 里还是 -1,
|
||||
// 后面 FileInputStream/FileOutputStream 就都在读 fd -1 ——
|
||||
// 表现是"pty 双向都不通",而且**异常被静默吞掉**,什么都看不到。
|
||||
android.util.Log.i("DoubaoTermux", "wrapFileDescriptor fd=" + fileDescriptor
|
||||
+ " -> 反射后=" + result);
|
||||
} catch (NoSuchFieldException | IllegalAccessException | IllegalArgumentException e) {
|
||||
android.util.Log.e("DoubaoTermux", "wrapFileDescriptor 反射失败", e);
|
||||
Logger.logStackTraceWithMessage(client, LOG_TAG, "Error accessing FileDescriptor#descriptor private field", e);
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user