From c9cb9a17c88d1d417d647520e98c8fdce8d4aa29 Mon Sep 17 00:00:00 2001 From: mattias Date: Wed, 19 Nov 2008 15:14:57 +0000 Subject: [PATCH] IDE: output filter: moved raise exception behind finally: buggy TProcess git-svn-id: trunk@17447 - --- ide/exttooldialog.pas | 5 ++++- ide/outputfilter.pas | 12 +++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ide/exttooldialog.pas b/ide/exttooldialog.pas index 46f846e356..bcb3acc1ea 100644 --- a/ide/exttooldialog.pas +++ b/ide/exttooldialog.pas @@ -409,14 +409,17 @@ begin on e: Exception do begin DebugLn('TExternalToolList.Run ',lisExtToolFailedToRunTool, ' ', E.Message); DumpExceptionBackTrace; + DebugLn(['TExternalToolList.Run AAA1']); Result:=MessageDlg(lisExtToolFailedToRunTool, Format(lisExtToolUnableToRunTheTool, ['"', Title, '"', #13, e.Message] ), mtError,[mbIgnore,mbAbort],0); + DebugLn(['TExternalToolList.Run AAA2']); if Result=mrIgnore then Result:=mrCancel; + DebugLn(['TExternalToolList.Run AAA3']); PutExitInfoBuilder(Format(lisExtToolUnableToRunTheTool, ['"', Title, '"', #13, e.Message])); - exit; + DebugLn(['TExternalToolList.Run AAA4']); end; end; end; diff --git a/ide/outputfilter.pas b/ide/outputfilter.pas index 89c7663a3f..cc7affb1d0 100644 --- a/ide/outputfilter.pas +++ b/ide/outputfilter.pas @@ -23,6 +23,8 @@ unit OutputFilter; {$mode objfpc} {$H+} +{off $DEFINE VerboseOFExecute} + interface uses @@ -259,6 +261,7 @@ var TheAsyncProcess: TAsyncProcess; LastProcessMessages: TDateTime; EndUpdateNeeded: Boolean; + ExceptionMsg: String; begin Result:=true; Clear; @@ -278,6 +281,7 @@ begin Aborted:=false; TheAsyncProcess:=nil; EndUpdateNeeded:=false; + ExceptionMsg:=''; try BeginBufferingOutput; @@ -287,7 +291,7 @@ begin and (not CreateScanners(Tool.Scanners)) then exit; - debugln(['TOutputFilter.Execute ',dbgsname(fProcess)]); + //debugln(['TOutputFilter.Execute ',dbgsname(fProcess)]); if fProcess is TAsyncProcess then begin TheAsyncProcess:=TAsyncProcess(fProcess); TheAsyncProcess.OnReadData:=@OnAsyncReadData; @@ -369,13 +373,13 @@ begin if not fProcess.WaitOnExit then begin // process was terminated by signal or OS if ErrorExists and (ofoExceptionOnError in Options) then - raise EOutputFilterError.Create('process terminated with errors'); + ExceptionMsg:='process terminated with errors'; end else begin //DebugLn('TOutputFilter.Execute fProcess.ExitStatus=',dbgs(fProcess.ExitStatus)); if fProcess.ExitStatus=0 then ErrorExists:=false; if ErrorExists and (ofoExceptionOnError in Options) then - raise EOutputFilterError.Create('there was an error'); + ExceptionMsg:='the process exited with error code '+dbgs(fProcess.ExitStatus); end; finally {$IFDEF VerboseOFExecute} @@ -410,6 +414,8 @@ begin WriteLn('TOutputFilter.Execute W7'); {$ENDIF} end; + if ExceptionMsg<>'' then + raise EOutputFilterError.Create(ExceptionMsg); end; procedure TOutputFilter.ReadLine(var s: string; DontFilterLine: boolean);