mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 13:45:58 +02:00
+ New procedure SysFlushStdIO (code taken from InternalExit).
* InternalExit: now calls new procedure SysFlushStdIO * DoneThread: Also calls SysFlushStdIO to avoid loosing output if standard files are redirected. git-svn-id: trunk@17798 -
This commit is contained in:
parent
9c11ee5544
commit
2d5ca71a06
@ -847,31 +847,11 @@ Procedure FinalizeHeap;forward;
|
||||
{$endif HAS_MEMORYMANAGER}
|
||||
{$endif FPC_HAS_FEATURE_HEAP}
|
||||
|
||||
|
||||
Procedure InternalExit;
|
||||
{$ifdef FPC_HAS_FEATURE_CONSOLEIO}
|
||||
procedure SysFlushStdIO;
|
||||
var
|
||||
current_exit : Procedure;
|
||||
{$ifdef FPC_HAS_FEATURE_CONSOLEIO}
|
||||
pstdout : ^Text;
|
||||
{$endif}
|
||||
{$if defined(MSWINDOWS) or defined(OS2)}
|
||||
i : longint;
|
||||
{$endif}
|
||||
Begin
|
||||
{$ifdef SYSTEMDEBUG}
|
||||
writeln('InternalExit');
|
||||
{$endif SYSTEMDEBUG}
|
||||
while exitProc<>nil Do
|
||||
Begin
|
||||
InOutRes:=0;
|
||||
current_exit:=tProcedure(exitProc);
|
||||
exitProc:=nil;
|
||||
current_exit();
|
||||
End;
|
||||
{ Finalize units }
|
||||
FinalizeUnits;
|
||||
|
||||
{$ifdef FPC_HAS_FEATURE_CONSOLEIO}
|
||||
begin
|
||||
{ Show runtime error and exit }
|
||||
pstdout:=@stdout;
|
||||
If erroraddr<>nil Then
|
||||
@ -892,6 +872,32 @@ Begin
|
||||
Flush(pstdout^);
|
||||
if Textrec(StdErr).Mode=fmOutput then
|
||||
Flush(StdErr);
|
||||
end;
|
||||
{$endif FPC_HAS_FEATURE_CONSOLEIO}
|
||||
|
||||
|
||||
Procedure InternalExit;
|
||||
var
|
||||
current_exit : Procedure;
|
||||
{$if defined(MSWINDOWS) or defined(OS2)}
|
||||
i : longint;
|
||||
{$endif}
|
||||
Begin
|
||||
{$ifdef SYSTEMDEBUG}
|
||||
writeln('InternalExit');
|
||||
{$endif SYSTEMDEBUG}
|
||||
while exitProc<>nil Do
|
||||
Begin
|
||||
InOutRes:=0;
|
||||
current_exit:=tProcedure(exitProc);
|
||||
exitProc:=nil;
|
||||
current_exit();
|
||||
End;
|
||||
{ Finalize units }
|
||||
FinalizeUnits;
|
||||
|
||||
{$ifdef FPC_HAS_FEATURE_CONSOLEIO}
|
||||
SysFlushStdIO;
|
||||
{$endif FPC_HAS_FEATURE_CONSOLEIO}
|
||||
|
||||
{$if defined(MSWINDOWS) or defined(OS2)}
|
||||
|
@ -1093,6 +1093,7 @@ Procedure SysInitExceptions;
|
||||
{$endif FPC_HAS_FEATURE_EXCEPTIONS}
|
||||
{$ifdef FPC_HAS_FEATURE_CONSOLEIO}
|
||||
procedure SysInitStdIO;
|
||||
procedure SysFlushStdIO;
|
||||
{$endif FPC_HAS_FEATURE_CONSOLEIO}
|
||||
{$ifndef FPUNONE}
|
||||
Procedure SysResetFPU;
|
||||
|
@ -67,6 +67,10 @@ Var
|
||||
{$endif HAS_MEMORYMANAGER}
|
||||
if MemoryManager.DoneThread <> nil then
|
||||
MemoryManager.DoneThread();
|
||||
{$ifdef FPC_HAS_FEATURE_CONSOLEIO}
|
||||
{ Open all stdio fds again }
|
||||
SysFlushStdio;
|
||||
{$endif FPC_HAS_FEATURE_CONSOLEIO}
|
||||
CurrentTM.ReleaseThreadVars;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user