Display conpty terminal process failure message #18998
Open
+37
−12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Problem: When opening a conpty terminal, if process startup fails, it will silently exit. As a result, the Test_terminal_shell_option in test_terminal3.vim failed in conpty.
In a winpty terminal, the winpty-provided error message "CreateProcess failed" was displayed. The test is designed to catch this error as an exception.
Solution: Conpty now displays error messages in the same way as winpty.
In addition, since the GetWin32Error() function can obtain more detailed error messages, the format has been changed to "CreateProcess failed: {localized message from the OS}" for conpty.
Also, since the GetWin32Error() function returns errors in ACP (Active Code Page) encoding, these have been converted to Vim's internal encoding, enc. This will prevent messages from being garbled in Japanese environments, etc. The output of this function was basically used by the semsg() function in other places, so this change also fixes potential similar garbled characters.
The test now errors out immediately in places where it is expected not to be reached, and comments have been added about the expected content of the winpty and conpty error messages.