pforth icon indicating copy to clipboard operation
pforth copied to clipboard

Interactive pForth does not work when run from MiniGW Bash

Open MaxBarraclough opened this issue 4 years ago • 1 comments

I'm running Windows 10/AMD64. I compiled pForth using Visual Studio 2019.

I'm able to run pForth from PowerShell or from the old cmd terminal and interactive usage works fine, but if I try to run it from the MiniGW Bash terminal (the one that ships with Git for Windows), pForth doesn't behave as expected. It seems not to ever receive commands typed into the prompt. Pressing enter does not have the effect of submitting a line to pForth for processing.

For comparison, Gforth runs fine in all three terminals.

Perhaps related to the use of getchar?

MaxBarraclough avatar Mar 10 '21 14:03 MaxBarraclough

I guess the _getch() from the visual c++ runtime doesn't work well in the mintty https://github.com/philburk/pforth/blob/master/csrc/win32_console/pf_io_win32_console.c#L198

and I found if you press ctrl-c when the program is blocked, all the input before the ctrl-c will be sent to the shell. It seems that the program is waiting for the input from a source which is different from the standard input.

I also tried to build pforth with cygwin and run it from the mintty. It works, not perfectly though. The terminal attribute control still breaks in the mintty, so you will see all input showed twice and encounter the getchar issue. At last I tried the mintty that ships with cygwin, everything goes well.

letoh avatar Aug 18 '21 08:08 letoh