diff --git a/rtl/win16/sysfile.inc b/rtl/win16/sysfile.inc index bb4d57d8a9..8809cba249 100644 --- a/rtl/win16/sysfile.inc +++ b/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; diff --git a/rtl/win16/system.pp b/rtl/win16/system.pp index 281afa003b..84fae2e2b8 100644 --- a/rtl/win16/system.pp +++ b/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