Browse Source

* Fix windows code to avoid closing unopened files

git-svn-id: trunk@16342 -
pierre 14 years ago
parent
commit
365c0d82bf
1 changed files with 8 additions and 0 deletions
  1. 8 0
      tests/utils/redir.pp

+ 8 - 0
tests/utils/redir.pp

@@ -265,8 +265,10 @@ end;
 {$endif}
 {$endif}
 
 
 
 
+{$ifndef windows}
 var
 var
   TempHOut, TempHIn,TempHError : longint;
   TempHOut, TempHIn,TempHError : longint;
+{$endif ndef windows}
 
 
 {
 {
 For Unix the following functions exist
 For Unix the following functions exist
@@ -545,7 +547,9 @@ function ChangeRedirError(Const Redir : String; AppendToFile : Boolean) : Boolea
     fpdup2(TempHOut,StdOutputHandle);
     fpdup2(TempHOut,StdOutputHandle);
 {$endif not windows}
 {$endif not windows}
     Close (FOUT^);
     Close (FOUT^);
+{$ifndef windows}
     fpclose(TempHOut);
     fpclose(TempHOut);
+{$endif ndef windows}
     RedirChangedOut:=false;
     RedirChangedOut:=false;
   end;
   end;
 
 
@@ -566,7 +570,9 @@ function ChangeRedirError(Const Redir : String; AppendToFile : Boolean) : Boolea
 {$endif not windows}
 {$endif not windows}
 {$endif}
 {$endif}
     Close (FIn^);
     Close (FIn^);
+{$ifndef windows}
     fpclose(TempHIn);
     fpclose(TempHIn);
+{$endif ndef windows}
     RedirChangedIn:=false;
     RedirChangedIn:=false;
   end;
   end;
 
 
@@ -667,7 +673,9 @@ function ChangeRedirError(Const Redir : String; AppendToFile : Boolean) : Boolea
     { don't close when redirected to STDOUT }
     { don't close when redirected to STDOUT }
     if not RedirStdErrToStdOut then
     if not RedirStdErrToStdOut then
       Close (FERR^);
       Close (FERR^);
+{$ifndef windows}
     fpclose(TempHError);
     fpclose(TempHError);
+{$endif ndef windows}
     RedirChangedError:=false;
     RedirChangedError:=false;
   end;
   end;