static char_u *exe_path = NULL;
+static BOOL is_win7 = FALSE;
static BOOL win8_or_later = FALSE;
/*
g_PlatformId = ovi.dwPlatformId;
+ if ((ovi.dwMajorVersion == 6 && ovi.dwMinorVersion == 1))
+ is_win7 = TRUE;
+
if ((ovi.dwMajorVersion == 6 && ovi.dwMinorVersion >= 2)
|| ovi.dwMajorVersion > 6)
win8_or_later = TRUE;
else
return mch_system_classic(cmd, options);
}
+
#else
# ifdef FEAT_MBYTE
static int
-mch_system(char *cmd, int options)
+mch_system1(char *cmd, int options)
{
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
return system(cmd);
}
# else
-# define mch_system(c, o) system(c)
+# define mch_system1(c, o) system(c)
# endif
+ static int
+mch_system(char *cmd, int options)
+{
+ int ret;
+
+ /*
+ * Restore non-termcap screen buffer before execute external program, and
+ * revert it after. Because msys and msys2's programs will cause freeze
+ * or crash conhost.exe (Windows's console window provider) and vim.exe,
+ * if active screen buffer is vim's one on Windows7.
+ */
+ if (is_win7 && g_fTermcapMode)
+ SetConsoleActiveScreenBuffer(g_cbNonTermcap.handle);
+
+ ret = mch_system1(cmd, options);
+
+ if (is_win7 && g_fTermcapMode)
+ SetConsoleActiveScreenBuffer(g_cbTermcap.handle);
+
+ return ret;
+}
+
#endif
/*