mirror of https://gitlab.com/basile.b/dexed.git
#253 - indicate when program return custom codes
This commit is contained in:
parent
92fcd93979
commit
c3a7574a8d
|
@ -98,14 +98,23 @@ function prettyReturnStatus(proc: TProcess): string;
|
||||||
{$IFDEF UNIX}
|
{$IFDEF UNIX}
|
||||||
var
|
var
|
||||||
s: integer;
|
s: integer;
|
||||||
|
u: integer;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
result := '';
|
result := '';
|
||||||
|
s := proc.ExitStatus;
|
||||||
{$IFDEF UNIX}
|
{$IFDEF UNIX}
|
||||||
if proc.ExitStatus and $80 > 0 then
|
if s > 255 then
|
||||||
begin
|
begin
|
||||||
s := proc.ExitStatus - 128;
|
u := s div 256;
|
||||||
if s > 0 then case s of
|
result := intToStr(u) + ' (Program-defined exit status)';
|
||||||
|
end
|
||||||
|
else if s > 127 then
|
||||||
|
begin
|
||||||
|
u := s - 128;
|
||||||
|
if s > 128 then
|
||||||
|
case u of
|
||||||
|
0: result := '128 (Invalid argument to exit)';
|
||||||
1: result := '1 (SIGHUP)';
|
1: result := '1 (SIGHUP)';
|
||||||
2: result := '2 (SIGINT)';
|
2: result := '2 (SIGINT)';
|
||||||
3: result := '3 (SIGQUIT)';
|
3: result := '3 (SIGQUIT)';
|
||||||
|
@ -144,7 +153,7 @@ begin
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if result = '' then
|
if result = '' then
|
||||||
result := intToStr(proc.ExitStatus);
|
result := intToStr(s) + ' (indeterminate meaning)';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TCEProcess.create(aOwner: TComponent);
|
constructor TCEProcess.create(aOwner: TComponent);
|
||||||
|
|
Loading…
Reference in New Issue