Browse Source

* flush standard files only if they are opend for output, resolves #11170

git-svn-id: trunk@10866 -
florian 17 years ago
parent
commit
ff9273bf0d
1 changed files with 8 additions and 4 deletions
  1. 8 4
      rtl/inc/system.inc

+ 8 - 4
rtl/inc/system.inc

@@ -825,10 +825,14 @@ Begin
    End;
    End;
 
 
   { Make sure that all output is written to the redirected file }
   { Make sure that all output is written to the redirected file }
-  Flush(Output);
-  Flush(ErrOutput);
-  Flush(pstdout^);
-  Flush(StdErr);
+  if Textrec(Output).Mode=fmOutput then
+    Flush(Output);
+  if Textrec(ErrOutput).Mode=fmOutput then
+    Flush(ErrOutput);
+  if Textrec(pstdout^).Mode=fmOutput then
+    Flush(pstdout^);
+  if Textrec(StdErr).Mode=fmOutput then
+    Flush(StdErr);
 {$endif FPC_HAS_FEATURE_CONSOLEIO}
 {$endif FPC_HAS_FEATURE_CONSOLEIO}
 
 
 {$if defined(MSWINDOWS) or defined(OS2)}
 {$if defined(MSWINDOWS) or defined(OS2)}