View Issue Details

IDProjectCategoryView StatusLast Update
0018037FPCRTLpublic2010-11-24 10:24
ReporterZAN DoYe Assigned ToJonas Maebe  
PrioritynormalSeveritytextReproducibilityalways
Status resolvedResolutionno change required 
Platformx86_64OSArchLinux 
Product Version2.4.3 
Summary0018037: unit crt cause the display shift right
DescriptionTo use ls directly, the screenshot:

[kandu@bomb ~]$ ls
bak Desktop Downloads Media t t.pas
bin Documents Dropbox pro t.o 雜亂的筆記本
[kandu@bomb ~]$

then I call ls in fpc:

uses unix; begin sehl('ls'); end.

This one works well, the screenshot is the same as the above. But if add unit crt, e.g.

uses crt,unix; begin shell('ls'); end.

the screenshot will be:
[kandu@bomb ~]$ ./t
bak Desktop Downloads Media t t.pas
                                            bin Documents Dropbox pro t.o 雜亂的筆記本
                  [kandu@bomb ~]$


I've test this program in gnome-terminal xterm and console.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Relationships

has duplicate 0029679 resolvedJonas Maebe CRT unit strangely alters behavior of Writeln on Linux 

Activities

Jonas Maebe

2010-11-24 10:24

manager   ~0043461

The crt unit is a Turbo Pascal-compatibility unit. To be able to provide all functionality that was available under Dos, the terminal under Unix has to be put in so-called "raw" mode. Almost all programs expect the terminal to be in its default "cooked" mode however, so it is normal that the output of externally executed programs will be messed up.

The best solution is probably to use tprocess to execute the external program and then write the external process' output yourself, see http://wiki.freepascal.org/Executing_External_Programs for more info.

Please ask on the mailing lists if you need more help with this.

Issue History

Date Modified Username Field Change
2010-11-24 03:10 ZAN DoYe New Issue
2010-11-24 10:24 Jonas Maebe Status new => resolved
2010-11-24 10:24 Jonas Maebe Resolution open => no change required
2010-11-24 10:24 Jonas Maebe Assigned To => Jonas Maebe
2010-11-24 10:24 Jonas Maebe Note Added: 0043461
2016-02-19 16:17 Jonas Maebe Relationship added has duplicate 0029679