Nessesarius / 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 #362

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Compile any program that uses CRT 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---
uses crt;
var X:integer;
begin
  Write('X := '); Read(X);
  WriteLn('X*X = ',X*X);
end.
---^--- cut ---^---

After compiling that program and running it in mintty the program doesn't show 
anything, entering data does nothing and after CTRL+C the data entered is 
treated as commands:
---v--- cut ---v---
user@host ~
$ ./test.exe
2
3
4

user@host ~
$ 2
-bash: 2: nie znaleziono polecenia

user@host ~
$ 3
-bash: 3: nie znaleziono polecenia

user@host ~
$ 4
-bash: 4: nie znaleziono polecenia
---^--- cut ---^---

Running the same executable with standalone bash.exe program 
(C:\cygwin\bin\bash.exe) everything goes as expected:
---v--- cut ---v---
user@host ~
$ ./test.exe
X := 2
X*X = 4
---^--- cut ---^---

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

Attachments:

GoogleCodeExporter commented 8 years ago
Issue 56 again. Presumably the implementation of the CRT unit uses Windows 
functions specific to console windows, in particular ReadConsole() for input. 
Those just don't work in terminals like mintty that are based on Cygwin pseudo 
terminal devices, which in turn implemented using Windows pipes. Hence the 
input remains buffered until bash retrieves it.

Other than using a Windows console (or a wrapper like Console2), the only 
proper solution here would be to use a Cygwin build of FPC. Or you could try 
the various utilities linked to from issue 56: conin, winpty, shell-terminal.

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