[vim/vim] Don't immediately close the input handle to conpty on EOF (PR #19025)

6 views
Skip to first unread message

MURAOKA Taro

unread,
Dec 26, 2025, 10:42:44 AM (2 days ago) Dec 26
to vim/vim, Subscribed

Problem: Conpty terminal process may not start. It causes the following tests to fail in Windows conpty:

  • Test_terminal_duplicate_eof_arg()
  • Test_terminal_eof_arg()
  • Test_terminal_eof_arg_win32_ctrl_z()

To be precise, the process is launched, but immediately after it is launched, the input handle to the console is closed with the EOF of the input, and the console is terminated. When the console is terminated, the associated process is also terminated.

Solution: Do not close the input handle at EOF.

In the Windows pseudo console, input and output handles are closed after the process in the console has terminated. This is not explicitly stated in Microsoft's documentation. However, looking at the code for Windows Terminal, which is presented as a complete example of the pseudo console, it is implemented exactly this way.

See the sample codes below:

The handle that is not closed at EOF is closed when Vim detects the end of the job, so there is no risk of them being forgotten and leaking.

ch_anonymous_pipe, which was used to determine whether a channel was for conpty, was set to TRUE only when conpty was being used. The definition also had the comment // ConPTY attached to it. This name is not very appropriate, but I felt it would be rude to add a new field to channel_T just for this purpose, so I reused it.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/19025

Commit Summary

  • 7397d0a Don't immediately close the input handle to conpty on EOF

File Changes

(2 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19025@github.com>

MURAOKA Taro

unread,
Dec 26, 2025, 10:49:39 AM (2 days ago) Dec 26
to vim/vim, Subscribed
koron left a comment (vim/vim#19025)

cf.

Complete examples of using the Pseudoconsole are available on our GitHub repository microsoft/terminal in the samples directory.

https://learn.microsoft.com/en-us/windows/console/creating-a-pseudoconsole-session#:~:text=Complete%20examples%20of%20using%20the%20Pseudoconsole%20are%20available%20on%20our%20GitHub%20repository%20microsoft/terminal%20in%20the%20samples%20directory.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19025/c3693038461@github.com>

Christian Brabandt

unread,
Dec 27, 2025, 9:35:56 AM (yesterday) Dec 27
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#19025)

thanks


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19025/c3694015191@github.com>

Christian Brabandt

unread,
Dec 27, 2025, 9:57:01 AM (yesterday) Dec 27
to vim/vim, Subscribed

Closed #19025 via 9f5b09e.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19025/issue_event/21765929246@github.com>

Reply all
Reply to author
Forward
0 new messages