Bladeren bron

* Write unhandled exceptions to StdErr. Option to revert back to old behaviour (Bug ID 17346)

git-svn-id: trunk@30140 -
michael 10 jaren geleden
bovenliggende
commit
bda3626025
2 gewijzigde bestanden met toevoegingen van 7 en 2 verwijderingen
  1. 2 1
      rtl/objpas/sysutils/sysutilh.inc
  2. 5 1
      rtl/objpas/sysutils/sysutils.inc

+ 2 - 1
rtl/objpas/sysutils/sysutilh.inc

@@ -255,7 +255,8 @@ type
 
 
 Var
 Var
    OnShowException : Procedure (Msg : ShortString);
    OnShowException : Procedure (Msg : ShortString);
-
+   WriteExceptionToStdErr : Boolean = True;
+   
 Const
 Const
    HexDisplayPrefix : string = '$';
    HexDisplayPrefix : string = '$';
 
 

+ 5 - 1
rtl/objpas/sysutils/sysutils.inc

@@ -289,8 +289,12 @@ Procedure CatchUnhandledException (Obj : TObject; Addr: CodePointer; FrameCount:
 Var
 Var
   i : longint;
   i : longint;
   hstdout : ^text;
   hstdout : ^text;
+  
 begin
 begin
-  hstdout:=@stdout;
+  if WriteExceptionToStdErr then
+    hstdout:=@stderr
+  else
+    hstdout:=@stdout;
   Writeln(hstdout^,'An unhandled exception occurred at $',HexStr(Addr),':');
   Writeln(hstdout^,'An unhandled exception occurred at $',HexStr(Addr),':');
   if Obj is exception then
   if Obj is exception then
     Writeln(hstdout^,Obj.ClassName,': ',Exception(Obj).Message)
     Writeln(hstdout^,Obj.ClassName,': ',Exception(Obj).Message)