runnables, unittests, prokect runner: display an error when exit code is not null

This commit is contained in:
Basile Burg 2015-12-06 15:51:35 +01:00
parent 2131e51016
commit e2af8f7ce3
3 changed files with 10 additions and 12 deletions

View File

@ -1660,6 +1660,9 @@ begin
inph := EntitiesConnector.getSingleService('ICEProcInputHandler');
if (inph <> nil) then
(inph as ICEProcInputHandler).removeProcess(proc);
if (proc.ExitStatus <> 0) then
fMsgs.message(format('error: the process (%s) has returned the signal %d',
[proc.Executable, proc.ExitStatus]), fDoc, amcEdit, amkErr);
end;
procedure TCEMainForm.actSetRunnableSwExecute(Sender: TObject);

View File

@ -795,6 +795,7 @@ var
lst: TStringList;
str: string;
msgs: ICEMessagesDisplay;
proc : TProcess;
begin
lst := TStringList.Create;
msgs := getMessageDisplay;
@ -809,10 +810,15 @@ begin
lst.Free;
end;
//
if not TProcess(sender).Active then
proc := TProcess(sender);
if not proc.Running then
begin
getprocInputHandler.removeProcess(TProcess(sender));
ChDir(fRunnerOldCwd);
//
if (proc.ExitStatus <> 0) then
msgs.message(format('error: the process (%s) has returned the signal %d',
[proc.Executable, proc.ExitStatus]), self as ICECommonProject, amcProj, amkErr);
end;
end;

View File

@ -104,7 +104,6 @@ var
begin
if not (poUsePipes in Options) then
exit;
sum := fOutputStack.Size;
while (Output <> nil) and (NumBytesAvailable > 0) do
begin
@ -112,7 +111,6 @@ begin
cnt := Output.Read((fOutputStack.Memory + sum)^, 1024);
sum += cnt;
end;
fOutputStack.SetSize(sum);
end;
@ -123,18 +121,9 @@ var
toread: Integer;
buff: Byte = 0;
str: TMemoryStream;
err: array[0..255] of Byte;
begin
if not Running then
begin
//TODO-cbugfix: errors not displayed when a runnable crashes
//if poStderrToOutPut in Options then
//if Stderr <> nil then while (true) do
//begin
// toread := Stderr.Read(err[0], length(err));
// if toread = 0 then break;
// fOutputStack.Write(err[0], toread);
//end;
list.LoadFromStream(fOutputStack);
if consume then
fOutputStack.Clear;