Severe output delay (~3.5s) when using useConptyDll: true with PowerShell 7
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- node.js, powershell
- Domain
- cli, operating-systems, performance
Research direction
Start by reproducing the timing comparison with useConptyDll set to true and false, using the bundled file at node_modules/@homebridge/node-pty-prebuilt-multiarch/build/Release/conpty/conpty.dll. Compare the first data batch and prompt delay, and check whether warmupConPtyDll changes the result. Done means identifying and correcting the bundled ConPTY startup delay without losing the reported IME stability benefit.
Written by the indexing model from the issue text.
Description
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
- 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');
}
});
- 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:
- System ConPTY: First data batch contains PowerShell version info and initialization output (83
bytes), prompt arrives in 340ms - 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
- Is this a known issue with the bundled conpty.dll?
- Are there any configuration options to control the output buffering behavior?
- What version of ConPTY is bundled, and could updating it help?
- 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).
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 337
- Avg merge
- 21h 58m
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/node-pty
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
All issues in microsoft/node-pty
Similar issues
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Crush Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md Open
Difficulty 1/5 Under an hour Newbie friendliness 90/100
ElementsProject/cln-application#167 · 1 comment · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Quantco/pnpm-licenses#17 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100