mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-24 15:19:21 +02:00
IDE: message widow: fixed showing ExitCode instead of ExitStatus of a process
git-svn-id: trunk@59899 -
This commit is contained in:
parent
9e8af3629d
commit
56ce57eedc
@ -379,6 +379,7 @@ type
|
|||||||
TExtToolView = class(TComponent)
|
TExtToolView = class(TComponent)
|
||||||
private
|
private
|
||||||
FCaption: string;
|
FCaption: string;
|
||||||
|
FExitCode: integer;
|
||||||
FExitStatus: integer;
|
FExitStatus: integer;
|
||||||
FLines: TMessageLines;
|
FLines: TMessageLines;
|
||||||
FMinUrgency: TMessageLineUrgency;
|
FMinUrgency: TMessageLineUrgency;
|
||||||
@ -414,6 +415,7 @@ type
|
|||||||
property Tool: TAbstractExternalTool read FTool;
|
property Tool: TAbstractExternalTool read FTool;
|
||||||
property Caption: string read FCaption write FCaption;
|
property Caption: string read FCaption write FCaption;
|
||||||
property OnChanged: TNotifyEvent read FOnChanged write FOnChanged; // called in main thread
|
property OnChanged: TNotifyEvent read FOnChanged write FOnChanged; // called in main thread
|
||||||
|
property ExitCode: integer read FExitCode write FExitCode;
|
||||||
property ExitStatus: integer read FExitStatus write FExitStatus;
|
property ExitStatus: integer read FExitStatus write FExitStatus;
|
||||||
property MinUrgency: TMessageLineUrgency read FMinUrgency write FMinUrgency default DefaultETViewMinUrgency; // hide messages below this
|
property MinUrgency: TMessageLineUrgency read FMinUrgency write FMinUrgency default DefaultETViewMinUrgency; // hide messages below this
|
||||||
property MessageLineClass: TMessageLineClass read FMessageLineClass;
|
property MessageLineClass: TMessageLineClass read FMessageLineClass;
|
||||||
@ -464,6 +466,7 @@ type
|
|||||||
FData: TObject;
|
FData: TObject;
|
||||||
FEnvironmentOverrides: TStrings;
|
FEnvironmentOverrides: TStrings;
|
||||||
FEstimatedLoad: int64;
|
FEstimatedLoad: int64;
|
||||||
|
FExitCode: integer;
|
||||||
FExitStatus: integer;
|
FExitStatus: integer;
|
||||||
FFreeData: boolean;
|
FFreeData: boolean;
|
||||||
FGroup: TExternalToolGroup;
|
FGroup: TExternalToolGroup;
|
||||||
@ -494,7 +497,6 @@ type
|
|||||||
const AMethod: TMethod);
|
const AMethod: TMethod);
|
||||||
protected
|
protected
|
||||||
FErrorMessage: string;
|
FErrorMessage: string;
|
||||||
FExitCode: integer;
|
|
||||||
FTerminated: boolean;
|
FTerminated: boolean;
|
||||||
FHandlers: array[TExternalToolHandler] of TMethodList;
|
FHandlers: array[TExternalToolHandler] of TMethodList;
|
||||||
FStage: TExternalToolStage;
|
FStage: TExternalToolStage;
|
||||||
@ -553,6 +555,7 @@ type
|
|||||||
procedure Terminate; virtual; abstract;
|
procedure Terminate; virtual; abstract;
|
||||||
procedure WaitForExit; virtual; abstract;
|
procedure WaitForExit; virtual; abstract;
|
||||||
property Terminated: boolean read FTerminated;
|
property Terminated: boolean read FTerminated;
|
||||||
|
property ExitCode: integer read FExitCode write FExitCode;
|
||||||
property ExitStatus: integer read FExitStatus write FExitStatus;
|
property ExitStatus: integer read FExitStatus write FExitStatus;
|
||||||
property ErrorMessage: string read FErrorMessage write FErrorMessage; // error executing tool
|
property ErrorMessage: string read FErrorMessage write FErrorMessage; // error executing tool
|
||||||
property ReadStdOutBeforeErr: boolean read FReadStdOutBeforeErr write FReadStdOutBeforeErr;
|
property ReadStdOutBeforeErr: boolean read FReadStdOutBeforeErr write FReadStdOutBeforeErr;
|
||||||
@ -2458,8 +2461,10 @@ begin
|
|||||||
finally
|
finally
|
||||||
LeaveCriticalSection;
|
LeaveCriticalSection;
|
||||||
end;
|
end;
|
||||||
if Tool<>nil then
|
if Tool<>nil then begin
|
||||||
|
ExitCode:=Tool.ExitCode;
|
||||||
ExitStatus:=Tool.ExitStatus;
|
ExitStatus:=Tool.ExitStatus;
|
||||||
|
end;
|
||||||
ToolExited;
|
ToolExited;
|
||||||
if Assigned(OnChanged) then begin
|
if Assigned(OnChanged) then begin
|
||||||
RemoveAsyncOnChanged;
|
RemoveAsyncOnChanged;
|
||||||
|
@ -668,7 +668,7 @@ begin
|
|||||||
inherited ToolExited;
|
inherited ToolExited;
|
||||||
if Tool.Terminated then begin
|
if Tool.Terminated then begin
|
||||||
ToolState:=lmvtsFailed;
|
ToolState:=lmvtsFailed;
|
||||||
end else if (ExitStatus<>0) then begin
|
end else if (ExitStatus<>0) or (ExitCode<>0) then begin
|
||||||
// tool stopped with errors
|
// tool stopped with errors
|
||||||
ErrCount:=0;
|
ErrCount:=0;
|
||||||
EnterCriticalSection;
|
EnterCriticalSection;
|
||||||
@ -700,9 +700,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
MsgLine:=PendingLines.CreateLine(-1);
|
MsgLine:=PendingLines.CreateLine(-1);
|
||||||
MsgLine.Urgency:=mluPanic;
|
MsgLine.Urgency:=mluPanic;
|
||||||
MsgLine.Msg:=Format(
|
if ExitCode<>0 then
|
||||||
lisToolStoppedWithExitCodeUseContextMenuToGetMoreInfo, [IntToStr(
|
MsgLine.Msg:=Format(
|
||||||
ExitStatus)]);
|
lisToolStoppedWithExitCodeUseContextMenuToGetMoreInfo, [IntToStr(
|
||||||
|
ExitCode)])
|
||||||
|
else
|
||||||
|
MsgLine.Msg:=Format(
|
||||||
|
lisToolStoppedWithExitStatusUseContextMenuToGetMoreInfo, [
|
||||||
|
IntToStr(ExitStatus)]);
|
||||||
PendingLines.Add(MsgLine);
|
PendingLines.Add(MsgLine);
|
||||||
finally
|
finally
|
||||||
LeaveCriticalSection;
|
LeaveCriticalSection;
|
||||||
@ -3280,8 +3285,10 @@ begin
|
|||||||
s+='ProcessID:'+LineEnding+IntToStr(Proc.ProcessID)+LineEnding+LineEnding;
|
s+='ProcessID:'+LineEnding+IntToStr(Proc.ProcessID)+LineEnding+LineEnding;
|
||||||
if Tool.Terminated then
|
if Tool.Terminated then
|
||||||
s+='Terminated'+LineEnding+LineEnding
|
s+='Terminated'+LineEnding+LineEnding
|
||||||
else
|
else begin
|
||||||
|
s+='ExitCode:'+LineEnding+IntToStr(Proc.ExitCode)+LineEnding;
|
||||||
s+='ExitStatus:'+LineEnding+IntToStr(Proc.ExitStatus)+LineEnding+LineEnding;
|
s+='ExitStatus:'+LineEnding+IntToStr(Proc.ExitStatus)+LineEnding+LineEnding;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
if Tool.ErrorMessage<>'' then
|
if Tool.ErrorMessage<>'' then
|
||||||
s+=lisError+Tool.ErrorMessage+LineEnding+LineEnding;
|
s+=lisError+Tool.ErrorMessage+LineEnding+LineEnding;
|
||||||
|
@ -75,6 +75,7 @@ type
|
|||||||
public
|
public
|
||||||
property Tool: TExternalTool read FTool write SetTool;
|
property Tool: TExternalTool read FTool write SetTool;
|
||||||
procedure Execute; override;
|
procedure Execute; override;
|
||||||
|
procedure DebuglnThreadLog(const Args: array of const);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -209,8 +210,13 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
EnterCriticalSection;
|
EnterCriticalSection;
|
||||||
try
|
try
|
||||||
if (not Terminated) and (ExitStatus<>0) and (ErrorMessage='') then
|
if (not Terminated) and (ErrorMessage='') then
|
||||||
ErrorMessage:=Format(lisExitCode, [IntToStr(ExitStatus)]);
|
begin
|
||||||
|
if ExitCode<>0 then
|
||||||
|
ErrorMessage:=Format(lisExitCode, [IntToStr(ExitCode)])
|
||||||
|
else if ExitStatus<>0 then
|
||||||
|
ErrorMessage:='ExitStatus '+IntToStr(ExitStatus);
|
||||||
|
end;
|
||||||
if FStage>=etsStopped then exit;
|
if FStage>=etsStopped then exit;
|
||||||
FStage:=etsStopped;
|
FStage:=etsStopped;
|
||||||
finally
|
finally
|
||||||
@ -1495,7 +1501,7 @@ begin
|
|||||||
if (fLines.Count>0)
|
if (fLines.Count>0)
|
||||||
and (Abs(int64(GetTickCount64)-LastUpdate)>UpdateTimeDiff) then begin
|
and (Abs(int64(GetTickCount64)-LastUpdate)>UpdateTimeDiff) then begin
|
||||||
{$IFDEF VerboseExtToolThread}
|
{$IFDEF VerboseExtToolThread}
|
||||||
DebuglnThreadLog(['TExternalToolThread.Execute ',Title,' ',TimeToStr(Now),' ',IntToStr(GetTickCount),' AddOutputLines ...']);
|
DebuglnThreadLog(['TExternalToolThread.Execute ',Title,' ',TimeToStr(Now),' ',IntToStr(GetTickCount64),' AddOutputLines ...']);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Tool.AddOutputLines(fLines);
|
Tool.AddOutputLines(fLines);
|
||||||
{$IFDEF VerboseExtToolThread}
|
{$IFDEF VerboseExtToolThread}
|
||||||
@ -1539,6 +1545,11 @@ begin
|
|||||||
DebuglnThreadLog(['TExternalToolThread.Execute ',Title,' reading exit status ...']);
|
DebuglnThreadLog(['TExternalToolThread.Execute ',Title,' reading exit status ...']);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Tool.ExitStatus:=Tool.Process.ExitStatus;
|
Tool.ExitStatus:=Tool.Process.ExitStatus;
|
||||||
|
Tool.ExitCode:=Tool.Process.ExitCode;
|
||||||
|
{$IFDEF VerboseExtToolThread}
|
||||||
|
if Tool.ExitStatus<>0 then
|
||||||
|
DebuglnThreadLog(['TExternalToolThread.Execute ',Title,' exit status=',Tool.ExitStatus,' ExitCode=',Tool.ExitCode]);
|
||||||
|
{$ENDIF}
|
||||||
except
|
except
|
||||||
Tool.ErrorMessage:=lisUnableToReadProcessExitStatus;
|
Tool.ErrorMessage:=lisUnableToReadProcessExitStatus;
|
||||||
end;
|
end;
|
||||||
@ -1591,6 +1602,11 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TExternalToolThread.DebuglnThreadLog(const Args: array of const);
|
||||||
|
begin
|
||||||
|
debugln(Args);
|
||||||
|
end;
|
||||||
|
|
||||||
destructor TExternalToolThread.Destroy;
|
destructor TExternalToolThread.Destroy;
|
||||||
begin
|
begin
|
||||||
Tool:=nil;
|
Tool:=nil;
|
||||||
|
@ -92,9 +92,12 @@ begin
|
|||||||
if Tool.Terminated then begin
|
if Tool.Terminated then begin
|
||||||
ToolState:=lmvtsFailed;
|
ToolState:=lmvtsFailed;
|
||||||
debugln('Error: (lazarus) ',Caption,': terminated');
|
debugln('Error: (lazarus) ',Caption,': terminated');
|
||||||
|
end else if (ExitCode<>0) then begin
|
||||||
|
ToolState:=lmvtsFailed;
|
||||||
|
debugln('Error: (lazarus) ',Caption,': stopped with exit code '+IntToStr(ExitCode));
|
||||||
end else if (ExitStatus<>0) then begin
|
end else if (ExitStatus<>0) then begin
|
||||||
ToolState:=lmvtsFailed;
|
ToolState:=lmvtsFailed;
|
||||||
debugln('Error: (lazarus) ',Caption,': stopped with exit code '+IntToStr(ExitStatus));
|
debugln('Error: (lazarus) ',Caption,': stopped with exit status '+IntToStr(ExitStatus));
|
||||||
end else if Tool.ErrorMessage<>'' then begin
|
end else if Tool.ErrorMessage<>'' then begin
|
||||||
ToolState:=lmvtsFailed;
|
ToolState:=lmvtsFailed;
|
||||||
debugln('Error: (lazarus) ',Caption,': ',Tool.ErrorMessage);
|
debugln('Error: (lazarus) ',Caption,': ',Tool.ErrorMessage);
|
||||||
|
@ -219,6 +219,7 @@ begin
|
|||||||
sl.Add(' Process.Running='+dbgs(Tool.Process.Running));
|
sl.Add(' Process.Running='+dbgs(Tool.Process.Running));
|
||||||
sl.Add(' CmdLineParams='+AnsiQuotedStr(Tool.CmdLineParams,'"'));
|
sl.Add(' CmdLineParams='+AnsiQuotedStr(Tool.CmdLineParams,'"'));
|
||||||
sl.Add(' ErrorMessage='+AnsiQuotedStr(Tool.ErrorMessage,'"'));
|
sl.Add(' ErrorMessage='+AnsiQuotedStr(Tool.ErrorMessage,'"'));
|
||||||
|
sl.Add(' ExitCode='+IntToStr(Tool.ExitCode));
|
||||||
sl.Add(' ExitStatus='+IntToStr(Tool.ExitStatus));
|
sl.Add(' ExitStatus='+IntToStr(Tool.ExitStatus));
|
||||||
sl.Add(' Terminated='+dbgs(Tool.Terminated));
|
sl.Add(' Terminated='+dbgs(Tool.Terminated));
|
||||||
sl.Add(' ReadStdOutBeforeErr='+dbgs(Tool.ReadStdOutBeforeErr));
|
sl.Add(' ReadStdOutBeforeErr='+dbgs(Tool.ReadStdOutBeforeErr));
|
||||||
|
@ -619,6 +619,8 @@ resourcestring
|
|||||||
lisShowMessageTypeID = 'Show Message Type ID';
|
lisShowMessageTypeID = 'Show Message Type ID';
|
||||||
lisToolStoppedWithExitCodeUseContextMenuToGetMoreInfo = 'tool stopped with '
|
lisToolStoppedWithExitCodeUseContextMenuToGetMoreInfo = 'tool stopped with '
|
||||||
+'exit code %s. Use context menu to get more information.';
|
+'exit code %s. Use context menu to get more information.';
|
||||||
|
lisToolStoppedWithExitStatusUseContextMenuToGetMoreInfo = 'tool stopped with '
|
||||||
|
+'ExitCode 0 and ExitStatus %s. Use context menu to get more information.';
|
||||||
lisErrors2 = ', Errors: %s';
|
lisErrors2 = ', Errors: %s';
|
||||||
lisWarnings = ', Warnings: %s';
|
lisWarnings = ', Warnings: %s';
|
||||||
lisHints = ', Hints: %s';
|
lisHints = ', Hints: %s';
|
||||||
|
Loading…
Reference in New Issue
Block a user