0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.1806: MS-Windows with Python: Vim freezes after import command

Problem:    MS-Windows with Python: Vim freezes after import command.
Solution:   Use either "NUL" or "CONIN$" when reopening stdin. (Yasuhiro
            Matsumoto, closes #7083)
This commit is contained in:
Bram Moolenaar 2020-10-06 19:59:06 +02:00
parent 80361a5f2b
commit 253b16a4ab
2 changed files with 11 additions and 6 deletions

View File

@ -917,6 +917,7 @@ reset_stdin(void)
{ {
FILE *(*py__acrt_iob_func)(unsigned) = NULL; FILE *(*py__acrt_iob_func)(unsigned) = NULL;
FILE *(*pyfreopen)(const char *, const char *, FILE *) = NULL; FILE *(*pyfreopen)(const char *, const char *, FILE *) = NULL;
char *stdin_name = "NUL";
HINSTANCE hinst; HINSTANCE hinst;
# ifdef DYNAMIC_PYTHON3 # ifdef DYNAMIC_PYTHON3
@ -933,16 +934,18 @@ reset_stdin(void)
if (py__acrt_iob_func) if (py__acrt_iob_func)
{ {
HINSTANCE hpystdiodll = find_imported_module_by_funcname(hinst, HINSTANCE hpystdiodll = find_imported_module_by_funcname(hinst,
"__acrt_iob_func"); "__acrt_iob_func");
if (hpystdiodll) if (hpystdiodll)
pyfreopen = (void*)GetProcAddress(hpystdiodll, "freopen"); pyfreopen = (void *)GetProcAddress(hpystdiodll, "freopen");
} }
if (isatty(fileno(stdin)))
stdin_name = "CONIN$";
// Reconnect stdin to NUL. // Reconnect stdin to NUL or CONIN$.
if (pyfreopen) if (pyfreopen != NULL)
pyfreopen("NUL", "r", py__acrt_iob_func(0)); pyfreopen(stdin_name, "r", py__acrt_iob_func(0));
else else
freopen("NUL", "r", stdin); freopen(stdin_name, "r", stdin);
} }
#else #else
# define reset_stdin() # define reset_stdin()

View File

@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1806,
/**/ /**/
1805, 1805,
/**/ /**/