Browse Source

* fixes to the win16 stderr output

git-svn-id: trunk@31849 -
nickysn 9 years ago
parent
commit
f5c2ce9058
2 changed files with 15 additions and 1 deletions
  1. 5 0
      rtl/win16/sysfile.inc
  2. 10 1
      rtl/win16/system.pp

+ 5 - 0
rtl/win16/sysfile.inc

@@ -403,6 +403,11 @@ function do_isdevice(handle:THandle):boolean;
 var
   regs: Registers;
 begin
+  if (handle=StdInputHandle) or (handle=StdOutputHandle) or (handle=StdErrorHandle) then
+    begin
+      do_isdevice:=true;
+      exit;
+    end;
   FillChar(regs,SizeOf(regs),0);
   regs.AX := $4400;
   regs.BX := handle;

+ 10 - 1
rtl/win16/system.pp

@@ -298,7 +298,7 @@ Begin
 End;
 
 
-procedure ErrorClose(Var F: TextRec);
+procedure ShowErrMsg;
 begin
   if ErrorLen>0 then
     begin
@@ -312,8 +312,16 @@ begin
 end;
 
 
+procedure ErrorClose(Var F: TextRec);
+begin
+  ShowErrMsg;
+end;
+
+
 procedure ErrorOpen(Var F: TextRec);
 Begin
+  TextRec(F).Handle:=StdErrorHandle;
+  TextRec(F).Mode:=fmOutput;
   TextRec(F).InOutFunc:=@ErrorWrite;
   TextRec(F).FlushFunc:=@ErrorWrite;
   TextRec(F).CloseFunc:=@ErrorClose;
@@ -355,6 +363,7 @@ begin
   Close(erroutput);
   Close(Input);
   Close(Output);
+  ShowErrMsg;
   asm
     mov al, byte [exitcode]
     mov ah, 4Ch