mirror of https://gitlab.com/basile.b/dexed.git
#253 - Interpret the process return code in a better way (posix)
This commit is contained in:
parent
10d6a2e915
commit
476d473f27
|
@ -906,10 +906,10 @@ begin
|
|||
begin
|
||||
getprocInputHandler.removeProcess(TProcess(sender));
|
||||
SetCurrentDirUTF8(fRunnerOldCwd);
|
||||
//
|
||||
|
||||
if (proc.ExitStatus <> 0) then
|
||||
fMsgs.message(format('error: the process (%s) has returned the code %d',
|
||||
[proc.Executable, proc.ExitStatus]), self as ICECommonProject, amcProj, amkErr);
|
||||
fMsgs.message(format('error: the process (%s) has returned the status %s',
|
||||
[proc.Executable, prettyReturnStatus(proc)]), self as ICECommonProject, amcProj, amkErr);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
|
|
@ -895,8 +895,12 @@ begin
|
|||
fMsgs.message(prjname + ' has been successfully compiled',
|
||||
self as ICECommonProject, amcProj, amkInf)
|
||||
else
|
||||
begin
|
||||
fMsgs.message(prjname + ' has not been compiled',
|
||||
self as ICECommonProject, amcProj, amkWarn);
|
||||
fMsgs.message(format('error: DUB has returned the status %s',
|
||||
[prettyReturnStatus(fDubProc)]), self as ICECommonProject, amcProj, amkErr);
|
||||
end;
|
||||
subjProjCompiled(fProjectSubject, self as ICECommonProject, fCompiled);
|
||||
SetCurrentDirUTF8(fPreCompilePath);
|
||||
end;
|
||||
|
|
|
@ -2800,8 +2800,8 @@ begin
|
|||
if inph.isNotNil then
|
||||
(inph as ICEProcInputHandler).removeProcess(proc);
|
||||
if (proc.ExitStatus <> 0) then
|
||||
fMsgs.message(format('error: the process (%s) has returned the code %d',
|
||||
[proc.Executable, proc.ExitStatus]), fDoc, amcEdit, amkErr);
|
||||
fMsgs.message(format('error: the process (%s) has returned the status %s',
|
||||
[proc.Executable, prettyReturnStatus(proc)]), fDoc, amcEdit, amkErr);
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.actSetRunnableSwExecute(Sender: TObject);
|
||||
|
@ -2972,8 +2972,8 @@ begin
|
|||
fDoc, amcEdit, amkInf);
|
||||
end
|
||||
else begin
|
||||
fMsgs.message(format('error: the process (%s) has returned the code %d',
|
||||
[dmdproc.Executable, dmdproc.ExitStatus]), fDoc, amcEdit, amkErr);
|
||||
fMsgs.message(format('error: the process (%s) has returned the status %s',
|
||||
[dmdproc.Executable, prettyReturnStatus(dmdproc)]), fDoc, amcEdit, amkErr);
|
||||
fMsgs.message(shortenPath(fDoc.fileName, 25) + ' has not been compiled',
|
||||
fDoc, amcEdit, amkErr);
|
||||
end;
|
||||
|
|
|
@ -80,6 +80,8 @@ type
|
|||
|
||||
procedure killProcess(var proc: TCEProcess);
|
||||
|
||||
function prettyReturnStatus(proc: TProcess): string;
|
||||
|
||||
implementation
|
||||
|
||||
procedure killProcess(var proc: TCEProcess);
|
||||
|
@ -92,6 +94,59 @@ begin
|
|||
proc := nil;
|
||||
end;
|
||||
|
||||
function prettyReturnStatus(proc: TProcess): string;
|
||||
{$IFDEF UNIX}
|
||||
var
|
||||
s: integer;
|
||||
{$ENDIF}
|
||||
begin
|
||||
result := '';
|
||||
{$IFDEF UNIX}
|
||||
if proc.ExitStatus and $80 > 0 then
|
||||
begin
|
||||
s := proc.ExitStatus - 128;
|
||||
if s > 0 then case s of
|
||||
1: result := '1 (SIGHUP)';
|
||||
2: result := '2 (SIGINT)';
|
||||
3: result := '3 (SIGQUIT)';
|
||||
4: result := '4 (SIGILL)';
|
||||
5: result := '4 (SIGTRAP)';
|
||||
6: result := '6 (SIGABRT)';
|
||||
7: result := '7 (SIGEMT)';
|
||||
8: result := '8 (SIGFPE)';
|
||||
9: result := '9 (SIGKILL)';
|
||||
10: result := '10 (SIGBUS)';
|
||||
11: result := '11 (SIGSEGV)';
|
||||
12: result := '12 (SIGSYS)';
|
||||
13: result := '13 (SIGPIPE)';
|
||||
14: result := '14 (SIGALRM)';
|
||||
15: result := '15 (SIGTERM)';
|
||||
16: result := '16 (SIGUSR1)';
|
||||
17: result := '17 (SIGUSR2)';
|
||||
18: result := '18 (SIGCHLD)';
|
||||
19: result := '19 (SIGPWR)';
|
||||
20: result := '20 (SIGWINCH)';
|
||||
21: result := '21 (SIGURG)';
|
||||
22: result := '22 (SIGPOLL)';
|
||||
23: result := '23 (SIGSTOP)';
|
||||
24: result := '24 (SIGTSTP)';
|
||||
25: result := '25 (SIGCONT)';
|
||||
26: result := '26 (SIGTTIN)';
|
||||
27: result := '27 (SIGTTOU)';
|
||||
28: result := '28 (SIGVTALRM)';
|
||||
29: result := '29 (SIGPROF)';
|
||||
30: result := '30 (SIGXCPU)';
|
||||
31: result := '31 (SIGXFSZ)';
|
||||
32: result := '32 (SIGWAITING)';
|
||||
33: result := '33 (SIGLWP)';
|
||||
34: result := '34 (SIGAIO)';
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
if result = '' then
|
||||
result := intToStr(proc.ExitStatus);
|
||||
end;
|
||||
|
||||
constructor TCEProcess.create(aOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
|
|
|
@ -261,10 +261,21 @@ begin
|
|||
lst.Free;
|
||||
end;
|
||||
end;
|
||||
if (not fProcess.Running) and fNextToolAlias.isNotEmpty then
|
||||
if (not fProcess.Running) then
|
||||
begin
|
||||
nxt := fToolItems.findTool(fNextToolAlias);
|
||||
if nxt.isNotNil then nxt.execute(self);
|
||||
if fProcess.ExitStatus > 0 then
|
||||
begin
|
||||
fMsgs.message(format('error: the tool (%s) has returned the status %s',
|
||||
[fProcess.Executable, prettyReturnStatus(fProcess)]), nil, amcMisc, amkErr);
|
||||
ce_processes.killProcess(fProcess);
|
||||
exit;
|
||||
end;
|
||||
if fNextToolAlias.isNotEmpty then
|
||||
begin
|
||||
nxt := fToolItems.findTool(fNextToolAlias);
|
||||
if nxt.isNotNil then
|
||||
nxt.execute(self);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{$ENDREGION --------------------------------------------------------------------}
|
||||
|
@ -277,15 +288,16 @@ begin
|
|||
inherited;
|
||||
fTools := TCEToolItems.Create(TCEToolItem);
|
||||
fname := getCoeditDocPath + toolsFname;
|
||||
if fname.fileExists then loadFromFile(fname);
|
||||
//
|
||||
if fname.fileExists then
|
||||
loadFromFile(fname);
|
||||
|
||||
EntitiesConnector.addObserver(self);
|
||||
end;
|
||||
|
||||
destructor TCETools.destroy;
|
||||
begin
|
||||
EntitiesConnector.removeObserver(self);
|
||||
//
|
||||
|
||||
ForceDirectoriesUTF8(getCoeditDocPath);
|
||||
saveToFile(getCoeditDocPath + toolsFname);
|
||||
fTools.Free;
|
||||
|
|
Loading…
Reference in New Issue