mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 20:21:04 +02:00
IDE: output filter: moved raise exception behind finally: buggy TProcess
git-svn-id: trunk@17447 -
This commit is contained in:
parent
37e5b6a1b4
commit
c9cb9a17c8
@ -409,14 +409,17 @@ begin
|
|||||||
on e: Exception do begin
|
on e: Exception do begin
|
||||||
DebugLn('TExternalToolList.Run ',lisExtToolFailedToRunTool, ' ', E.Message);
|
DebugLn('TExternalToolList.Run ',lisExtToolFailedToRunTool, ' ', E.Message);
|
||||||
DumpExceptionBackTrace;
|
DumpExceptionBackTrace;
|
||||||
|
DebugLn(['TExternalToolList.Run AAA1']);
|
||||||
Result:=MessageDlg(lisExtToolFailedToRunTool,
|
Result:=MessageDlg(lisExtToolFailedToRunTool,
|
||||||
Format(lisExtToolUnableToRunTheTool, ['"', Title, '"', #13, e.Message]
|
Format(lisExtToolUnableToRunTheTool, ['"', Title, '"', #13, e.Message]
|
||||||
),
|
),
|
||||||
mtError,[mbIgnore,mbAbort],0);
|
mtError,[mbIgnore,mbAbort],0);
|
||||||
|
DebugLn(['TExternalToolList.Run AAA2']);
|
||||||
if Result=mrIgnore then Result:=mrCancel;
|
if Result=mrIgnore then Result:=mrCancel;
|
||||||
|
DebugLn(['TExternalToolList.Run AAA3']);
|
||||||
PutExitInfoBuilder(Format(lisExtToolUnableToRunTheTool,
|
PutExitInfoBuilder(Format(lisExtToolUnableToRunTheTool,
|
||||||
['"', Title, '"', #13, e.Message]));
|
['"', Title, '"', #13, e.Message]));
|
||||||
exit;
|
DebugLn(['TExternalToolList.Run AAA4']);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -23,6 +23,8 @@ unit OutputFilter;
|
|||||||
{$mode objfpc}
|
{$mode objfpc}
|
||||||
{$H+}
|
{$H+}
|
||||||
|
|
||||||
|
{off $DEFINE VerboseOFExecute}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -259,6 +261,7 @@ var
|
|||||||
TheAsyncProcess: TAsyncProcess;
|
TheAsyncProcess: TAsyncProcess;
|
||||||
LastProcessMessages: TDateTime;
|
LastProcessMessages: TDateTime;
|
||||||
EndUpdateNeeded: Boolean;
|
EndUpdateNeeded: Boolean;
|
||||||
|
ExceptionMsg: String;
|
||||||
begin
|
begin
|
||||||
Result:=true;
|
Result:=true;
|
||||||
Clear;
|
Clear;
|
||||||
@ -278,6 +281,7 @@ begin
|
|||||||
Aborted:=false;
|
Aborted:=false;
|
||||||
TheAsyncProcess:=nil;
|
TheAsyncProcess:=nil;
|
||||||
EndUpdateNeeded:=false;
|
EndUpdateNeeded:=false;
|
||||||
|
ExceptionMsg:='';
|
||||||
try
|
try
|
||||||
BeginBufferingOutput;
|
BeginBufferingOutput;
|
||||||
|
|
||||||
@ -287,7 +291,7 @@ begin
|
|||||||
and (not CreateScanners(Tool.Scanners)) then
|
and (not CreateScanners(Tool.Scanners)) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
debugln(['TOutputFilter.Execute ',dbgsname(fProcess)]);
|
//debugln(['TOutputFilter.Execute ',dbgsname(fProcess)]);
|
||||||
if fProcess is TAsyncProcess then begin
|
if fProcess is TAsyncProcess then begin
|
||||||
TheAsyncProcess:=TAsyncProcess(fProcess);
|
TheAsyncProcess:=TAsyncProcess(fProcess);
|
||||||
TheAsyncProcess.OnReadData:=@OnAsyncReadData;
|
TheAsyncProcess.OnReadData:=@OnAsyncReadData;
|
||||||
@ -369,13 +373,13 @@ begin
|
|||||||
if not fProcess.WaitOnExit then begin
|
if not fProcess.WaitOnExit then begin
|
||||||
// process was terminated by signal or OS
|
// process was terminated by signal or OS
|
||||||
if ErrorExists and (ofoExceptionOnError in Options) then
|
if ErrorExists and (ofoExceptionOnError in Options) then
|
||||||
raise EOutputFilterError.Create('process terminated with errors');
|
ExceptionMsg:='process terminated with errors';
|
||||||
end else begin
|
end else begin
|
||||||
//DebugLn('TOutputFilter.Execute fProcess.ExitStatus=',dbgs(fProcess.ExitStatus));
|
//DebugLn('TOutputFilter.Execute fProcess.ExitStatus=',dbgs(fProcess.ExitStatus));
|
||||||
if fProcess.ExitStatus=0 then
|
if fProcess.ExitStatus=0 then
|
||||||
ErrorExists:=false;
|
ErrorExists:=false;
|
||||||
if ErrorExists and (ofoExceptionOnError in Options) then
|
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;
|
end;
|
||||||
finally
|
finally
|
||||||
{$IFDEF VerboseOFExecute}
|
{$IFDEF VerboseOFExecute}
|
||||||
@ -410,6 +414,8 @@ begin
|
|||||||
WriteLn('TOutputFilter.Execute W7');
|
WriteLn('TOutputFilter.Execute W7');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
if ExceptionMsg<>'' then
|
||||||
|
raise EOutputFilterError.Create(ExceptionMsg);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOutputFilter.ReadLine(var s: string; DontFilterLine: boolean);
|
procedure TOutputFilter.ReadLine(var s: string; DontFilterLine: boolean);
|
||||||
|
Loading…
Reference in New Issue
Block a user