mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 17:40:23 +00:00
issue a warning in legacy W10 terminals (PS/cmd)
Those terminal emulators block stdout/stderr output when scrolled, which effectively stops UltraGrid. The behavior doesn't occur in MS Terminal app, which is encouraged instead. Note that Windows Terminal still runs cmd.exe or powershell.exe as a shell while the cmd/PS process can acts like both terminal emulator and shell. We also do not trigger the warning if UG is run from within MSYS2 terminal.
This commit is contained in:
12
src/host.cpp
12
src/host.cpp
@@ -116,6 +116,8 @@ extern "C" {
|
||||
#include <mcheck.h>
|
||||
#endif
|
||||
|
||||
#define MOD_NAME "[host] "
|
||||
|
||||
using std::array;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
@@ -458,6 +460,16 @@ struct init_data *common_preinit(int argc, char *argv[])
|
||||
if (init_com) {
|
||||
com_initialize(&init.com_initialized, nullptr);
|
||||
}
|
||||
|
||||
// warn in W10 "legacy" terminal emulators
|
||||
if ((win_has_ancestor_process("powershell.exe") ||
|
||||
win_has_ancestor_process("cmd.exe")) &&
|
||||
!win_has_ancestor_process("WindowsTerminal.exe")) {
|
||||
MSG(WARNING, "Running inside PS/cmd terminal is not recommended "
|
||||
"because scrolling the output freezes the process, "
|
||||
"consider using Windows Terminal instead!\n");
|
||||
Sleep(1000);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (strstr(argv[0], "run_tests") == nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user