IDE: output filter: moved raise exception behind finally: buggy TProcess

git-svn-id: trunk@17447 -
This commit is contained in:
mattias 2008-11-19 15:14:57 +00:00
parent 37e5b6a1b4
commit c9cb9a17c8
2 changed files with 13 additions and 4 deletions

View File

@ -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;

View File

@ -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);