display proc params when background tool crashed

This commit is contained in:
Basile Burg 2016-11-10 12:12:08 +01:00
parent 2ccc064e62
commit edad9efe4c
No known key found for this signature in database
GPG Key ID: 1868039F415CB8CF
1 changed files with 6 additions and 3 deletions

View File

@ -15,7 +15,7 @@ uses
{$IFNDEF CEBUILD}
forms,
{$ENDIF}
process, asyncprocess, ghashmap, ghashset, LCLIntf;
process, asyncprocess, ghashmap, ghashset, LCLIntf, strutils;
const
exeExt = {$IFDEF WINDOWS} '.exe' {$ELSE} '' {$ENDIF};
@ -1311,7 +1311,7 @@ end;
procedure tryRaiseFromStdErr(proc: TProcess);
var
str: string;
str: string = '';
begin
if (proc.ExitStatus <> 0) and (poUsePipes in proc.Options) and not
(poStderrToOutPut in proc.Options) then with TStringList.Create do
@ -1319,7 +1319,10 @@ begin
LoadFromStream(proc.Stderr);
Insert(0, format('%s crashed with code: %d',
[shortenPath(proc.Executable), proc.ExitStatus]));
str := Text;
str += 'parameters:'#10;
str += proc.Parameters.Text;
str += 'stderr:'#10;
str += ReplaceStr(Text, #0, #10);
raise Exception.Create(str);
finally
free;