瀏覽代碼

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

git-svn-id: trunk@30140 -
michael 10 年之前
父節點
當前提交
bda3626025
共有 2 個文件被更改,包括 7 次插入2 次删除
  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
    OnShowException : Procedure (Msg : ShortString);
-
+   WriteExceptionToStdErr : Boolean = True;
+   
 Const
    HexDisplayPrefix : string = '$';
 

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

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