allow to check StdErr content at debug time

This commit is contained in:
Basile Burg 2016-11-04 15:30:53 +01:00
parent 6ed96833c7
commit 5d84f67e46
No known key found for this signature in database
GPG Key ID: 1868039F415CB8CF
1 changed files with 9 additions and 6 deletions

View File

@ -1324,14 +1324,17 @@ begin
end; end;
procedure tryRaiseFromStdErr(proc: TProcess); procedure tryRaiseFromStdErr(proc: TProcess);
var
str: string;
begin begin
if (proc.ExitStatus <> 0) and (poUsePipes in proc.Options) then if (proc.ExitStatus <> 0) and (poUsePipes in proc.Options) and not
with TStringList.Create do (poStderrToOutPut in proc.Options) then with TStringList.Create do
try try
LoadFromStream(proc.Stderr); LoadFromStream(proc.Stderr);
Insert(0, format('tool crashed with code: %d (%s)', Insert(0, format('%s crashed with code: %d',
[proc.ExitStatus, shortenPath(proc.Executable)])); [shortenPath(proc.Executable), proc.ExitStatus]));
raise Exception.Create(Text); str := Text;
raise Exception.Create(str);
finally finally
free; free;
end; end;
@ -1344,7 +1347,7 @@ begin
for i := strings.Count-1 downto 0 do for i := strings.Count-1 downto 0 do
begin begin
j := strings.IndexOf(strings[i]); j := strings.IndexOf(strings[i]);
if (j <> -1) and (j <> i) then if (j <> -1) and (j < i) then
strings.Delete(i); strings.Delete(i);
end; end;
end; end;