Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Severe output delay (~3.5s) when using useConptyDll: true with PowerShell 7

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

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
node.js, powershell

调研方向

首先使用 node_modules/@homebridge/node-pty-prebuilt-multiarch/build/Release/conpty/conpty.dll 中附带的文件,复现将 useConptyDll 设置为 true 和 false 时的时序对比。比较第一批数据和提示符延迟,并检查 warmupConPtyDll 是否会改变结果。完成的标准是识别并修正附带的 ConPTY 启动延迟,同时不损失已报告的 IME 稳定性收益。

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

描述

Description

When using the bundled conpty.dll (useConptyDll: true), PowerShell 7 initialization output is
severely delayed compared to using the system ConPTY. The prompt appears ~3.5 seconds later, making
the terminal feel unresponsive.

Environment

  • OS: Windows 11 Pro 10.0.22621
  • node-pty version: @homebridge/node-pty-prebuilt-multiarch@0.13.1
  • Shell: PowerShell 7.5.4 (pwsh.exe)
  • Node.js version: v22.21.1
  • Electron version: 28.0.0

Steps to Reproduce

  1. Create a PTY process with the following options:
    const pty = require('node-pty');

const ptyProcess = pty.spawn('pwsh.exe', [], {
name: 'xterm-256color',
cols: 80,
rows: 30,
cwd: process.cwd(),
env: process.env,
useConpty: true,
useConptyDll: true // Using bundled conpty.dll
});

let firstDataTime = null;
let promptTime = null;

ptyProcess.onData((data) => {
if (!firstDataTime) {
firstDataTime = Date.now();
console.log('First data:', data.substring(0, 100));
}

if (data.includes('PS ') && !promptTime) {
  promptTime = Date.now();
  console.log('Prompt received after:', promptTime - firstDataTime, 'ms');
}

});

  1. Compare with system ConPTY by setting useConptyDll: false

Expected Behavior

PowerShell prompt should appear within ~300-500ms, similar to system ConPTY behavior.

Actual Behavior

With useConptyDll: true, the PowerShell prompt appears after ~3800ms, making the terminal feel very
slow to start.

Detailed Comparison

System ConPTY (useConptyDll: false)

First data received: 83 bytes
Content: [?25l[2J[HPowerShell 7.5.4\r\n]0;C:\Program Files\PowerShell\7\pwsh.exe[?25h
Prompt detected after: 340ms

Bundled ConPTY (useConptyDll: true)

First data received: 4 bytes
Content: [1t
Prompt detected after: 3815ms

Analysis

The key difference is:

  1. System ConPTY: First data batch contains PowerShell version info and initialization output (83
    bytes), prompt arrives in 340ms
  2. Bundled ConPTY: First data batch contains only an ANSI escape sequence [1t (4 bytes), then waits
    ~3.8 seconds before sending the actual PowerShell output

This suggests that the bundled conpty.dll has a different output buffering or synchronization
mechanism that causes severe delays in forwarding the shell's initialization output.

Impact

This makes the bundled ConPTY unusable for applications that need responsive terminal startup. We
initially wanted to use useConptyDll: true to fix an IME (Input Method Editor) candidate box
flickering issue, but the 3.8-second delay is unacceptable for user experience.

Questions

  1. Is this a known issue with the bundled conpty.dll?
  2. Are there any configuration options to control the output buffering behavior?
  3. What version of ConPTY is bundled, and could updating it help?
  4. Is there a way to get the IME stability benefits of bundled ConPTY without the output delay?

Additional Context

  • The bundled conpty.dll is located at:
    node_modules/@homebridge/node-pty-prebuilt-multiarch/build/Release/conpty/conpty.dll
  • File size: 109,104 bytes
  • File date: Feb 28, 2025
  • We've also tried the warmupConPtyDll() approach (spawning a dummy PTY at startup), but it doesn't
    help with the per-terminal delay

Workaround

Currently using system ConPTY (useConptyDll: false) for fast startup, but this causes IME issues on
Windows (candidate box flickering during terminal output).

主要语言
TypeScript
星标
2k
派生
337
平均合并
21 小时 58 分钟
30 天内合并 PR
3

贡献指南

打开贡献指南

从这里开始

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

microsoft/node-pty 的其他 Issue

查看 microsoft/node-pty 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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