FreeBASIC not flushing output on msys2

Windows specific questions.
Post Reply
bubacxo
Posts: 12
Joined: May 29, 2019 20:02

FreeBASIC not flushing output on msys2

Post by bubacxo »

versions: FB 1.09 and 1.10, (I downloaded FreeBASIC-1.10.0-winlibs-gcc-9.3.0.7z)
windows 10 with msys2 (bash, xterm)

anyone else seen any symptoms like this?
  • no output at all if I'm at the bottom of the screen.
  • if there's enough output so that it needs to scroll, I see a flash of text going by, and only the last lines of output are displayed.
  • the line with the command [$ fbc --help ] will remain at the top of the screen instead of scrolling [ using screen commands ? ]
  • this happens not only with my own apps, but with the fbc64 command (fbc64 --help, for instance).
  • output is correct with bash scripts, python or any other program...
  • HOWEVER, calling fbc64.exe --help from windows console (cmd.exe) works correctly.
so I guess it's not really a bug, just an incompatibility with the msys console.

there is a hack for this, btw, you can pipe to another program, like cat or less:

Code: Select all

$ fbc --help |less
$ ./myprogram.exe | cat
so I'm not complaining or asking for help. Just wanted to ask:
do you use msys2 or bash under windows? have you experienced this?
or do you have any suggestion I can use with my own console programs?
angros47
Posts: 2321
Joined: Jun 21, 2005 19:04

Re: FreeBASIC not flushing output on msys2

Post by angros47 »

It seems related with this issue:

viewtopic.php?t=25124
bubacxo
Posts: 12
Joined: May 29, 2019 20:02

Re: FreeBASIC not flushing output on msys2

Post by bubacxo »

I agree that it is probably related.
I tried the solution posted by dkl (apparently, it's from /examples/console/disable-vt100-escapes.bas).

Code: Select all

extern "C"
	extern __fb_enable_vt100_escapes as long
	dim shared __fb_enable_vt100_escapes as long = 0
end extern
It didn't work for me. [this solution was said to fix OLD terminals, and I'm using the latest msys2 / mintty ]
I thought it might be an escape sequence or calls to screen, since as I said piping output to cat or to a file works.

But thanks for the helpful response. :P

Can't believe that I'm the only one seeing this, since it seems a lot of people are using msys2, and I didn't make any changes to the default install of freebasic or msys2...
bubacxo
Posts: 12
Joined: May 29, 2019 20:02

Re: FreeBASIC not flushing output on msys2

Post by bubacxo »

What's right is what's left if you do everything else wrong.
- Robin Williams
sooo, I found the solution to my stupid little problem
and poor little freeBASIC has been wrongly accused again! :? :shock: :twisted:

if you have this problem you can fix it by putting this in your .bashrc:
export MSYS=disable_pcon

or you can put this in your mintty config file: [ ~/.minttyrc ]
ConPTY=off

it's a long story, involving a fix for something that unfixed something else.
https://github.com/mintty/mintty/wiki/T ... n-programs

anyways, sorry for posting this to the wrong forum... :oops:
SOLVED
angros47
Posts: 2321
Joined: Jun 21, 2005 19:04

Re: FreeBASIC not flushing output on msys2

Post by angros47 »

Now FreeBASIC is an "alien program"?
coderJeff
Site Admin
Posts: 4313
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: FreeBASIC not flushing output on msys2

Post by coderJeff »

bubacxo wrote: May 26, 2023 20:21 do you use msys2 or bash under windows? have you experienced this?
I typically do not use msys2 terminals except to update installed software with 'pacman'.
I sometimes use 'sh' or 'bash' to run scripts - invoked from cmd.exe prompt or from a batch file.
Mostly I run everything under 'cmd.exe' including 'make' for building fbc itself.

Under msys2, I don't see any issues happening with scrolling / printing.

But a couple of other tests and I notice that under msys2, 'sleep' doesn't work as usual for me - the program is paused but no keypress allows the program to continue.

Code: Select all

SLEEP
Post Reply