vuuvv / mintty

Automatically exported from code.google.com/p/mintty
GNU General Public License v3.0
0 stars 0 forks source link

mintty 1.1.2 and FPC compiled program without CRT unit #363

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compile any program that not use CRT unit in Free Pascal Compiler (FPC)
2. Run that program using mintty
3. Run the same program using standalone bash.exe

What is the expected output? What do you see instead?
Results for mintty and standalone bash.exe the same

What versions of mintty, Cygwin/MSYS, and Windows are you using?
mintty: 1.1.12
Cygwin: 1.7.17-1
FPC:  2.6.0 [2011/12/25] for i386

Please provide any additional information below.
Example .pas file:
---v--- cut ---v---
Var X:Integer;
Begin
  Write('X := '); Read(X);
  WriteLn('X*X = ',X*X);
End.
---^--- cut ---^---

After compiling and running in mintty:
---v--- cut ---v---
user@host ~
$ ./test.exe
2
X := X*X = 4
---^--- cut ---^---

As you can see, the text is displayed after entering data.
Running that program in standalone bash.exe I get:
---v--- cut ---v---
user@host ~
$ ./test.exe
X := 3
X*X = 9
---^--- cut ---^---

Original issue reported on code.google.com by faram...@gmail.com on 1 Dec 2012 at 4:24

Attachments:

GoogleCodeExporter commented 9 years ago
Issue 56 again. Unlike issue 362 regarding the CRT unit, the problem here isn't 
the use of console-specific functions, but buffering. To a non-Cygwin program, 
Cygwin pty devices look like pipes, and for those, full buffering is enabled by 
default.

Possible workarounds include flushing output frequently using the Flush 
procedure, or disabling buffering. In C that can be done using setvbuf(), not 
sure whether FPC has an equivalent. SetTextBuf might do it. 

The utilities mentioned in issue 56 might help here too.

Original comment by andy.koppe on 2 Dec 2012 at 6:56