summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-10-06 19:59:06 +0200
committerBram Moolenaar <Bram@vim.org>2020-10-06 19:59:06 +0200
commit253b16a4abdad1df350b9ddd9a709520b063934c (patch)
treed25ce3c76cc4f33e8b69da98d739a3931f8747b8
parent80361a5f2b134c88597d60b3d363b52084e712a1 (diff)
patch 8.2.1806: MS-Windows with Python: Vim freezes after import commandv8.2.1806
Problem: MS-Windows with Python: Vim freezes after import command. Solution: Use either "NUL" or "CONIN$" when reopening stdin. (Yasuhiro Matsumoto, closes #7083)
-rw-r--r--src/if_python3.c15
-rw-r--r--src/version.c2
2 files changed, 11 insertions, 6 deletions
diff --git a/src/if_python3.c b/src/if_python3.c
index 15c1d9973e..f6904c3801 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -917,6 +917,7 @@ reset_stdin(void)
{
FILE *(*py__acrt_iob_func)(unsigned) = NULL;
FILE *(*pyfreopen)(const char *, const char *, FILE *) = NULL;
+ char *stdin_name = "NUL";
HINSTANCE hinst;
# ifdef DYNAMIC_PYTHON3
@@ -933,16 +934,18 @@ reset_stdin(void)
if (py__acrt_iob_func)
{
HINSTANCE hpystdiodll = find_imported_module_by_funcname(hinst,
- "__acrt_iob_func");
+ "__acrt_iob_func");
if (hpystdiodll)
- pyfreopen = (void*)GetProcAddress(hpystdiodll, "freopen");
+ pyfreopen = (void *)GetProcAddress(hpystdiodll, "freopen");
}
+ if (isatty(fileno(stdin)))
+ stdin_name = "CONIN$";
- // Reconnect stdin to NUL.
- if (pyfreopen)
- pyfreopen("NUL", "r", py__acrt_iob_func(0));
+ // Reconnect stdin to NUL or CONIN$.
+ if (pyfreopen != NULL)
+ pyfreopen(stdin_name, "r", py__acrt_iob_func(0));
else
- freopen("NUL", "r", stdin);
+ freopen(stdin_name, "r", stdin);
}
#else
# define reset_stdin()
diff --git a/src/version.c b/src/version.c
index b8b9917d06..a410167beb 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1806,
+/**/
1805,
/**/
1804,