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
|
begin
|
||||||
getprocInputHandler.removeProcess(TProcess(sender));
|
getprocInputHandler.removeProcess(TProcess(sender));
|
||||||
SetCurrentDirUTF8(fRunnerOldCwd);
|
SetCurrentDirUTF8(fRunnerOldCwd);
|
||||||
//
|
|
||||||
if (proc.ExitStatus <> 0) then
|
if (proc.ExitStatus <> 0) then
|
||||||
fMsgs.message(format('error: the process (%s) has returned the code %d',
|
fMsgs.message(format('error: the process (%s) has returned the status %s',
|
||||||
[proc.Executable, proc.ExitStatus]), self as ICECommonProject, amcProj, amkErr);
|
[proc.Executable, prettyReturnStatus(proc)]), self as ICECommonProject, amcProj, amkErr);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
|
@ -895,8 +895,12 @@ begin
|
||||||
fMsgs.message(prjname + ' has been successfully compiled',
|
fMsgs.message(prjname + ' has been successfully compiled',
|
||||||
self as ICECommonProject, amcProj, amkInf)
|
self as ICECommonProject, amcProj, amkInf)
|
||||||
else
|
else
|
||||||
|
begin
|
||||||
fMsgs.message(prjname + ' has not been compiled',
|
fMsgs.message(prjname + ' has not been compiled',
|
||||||
self as ICECommonProject, amcProj, amkWarn);
|
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);
|
subjProjCompiled(fProjectSubject, self as ICECommonProject, fCompiled);
|
||||||
SetCurrentDirUTF8(fPreCompilePath);
|
SetCurrentDirUTF8(fPreCompilePath);
|
||||||
end;
|
end;
|
||||||
|
|
|
@ -2800,8 +2800,8 @@ begin
|
||||||
if inph.isNotNil then
|
if inph.isNotNil then
|
||||||
(inph as ICEProcInputHandler).removeProcess(proc);
|
(inph as ICEProcInputHandler).removeProcess(proc);
|
||||||
if (proc.ExitStatus <> 0) then
|
if (proc.ExitStatus <> 0) then
|
||||||
fMsgs.message(format('error: the process (%s) has returned the code %d',
|
fMsgs.message(format('error: the process (%s) has returned the status %s',
|
||||||
[proc.Executable, proc.ExitStatus]), fDoc, amcEdit, amkErr);
|
[proc.Executable, prettyReturnStatus(proc)]), fDoc, amcEdit, amkErr);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMainForm.actSetRunnableSwExecute(Sender: TObject);
|
procedure TCEMainForm.actSetRunnableSwExecute(Sender: TObject);
|
||||||
|
@ -2972,8 +2972,8 @@ begin
|
||||||
fDoc, amcEdit, amkInf);
|
fDoc, amcEdit, amkInf);
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
fMsgs.message(format('error: the process (%s) has returned the code %d',
|
fMsgs.message(format('error: the process (%s) has returned the status %s',
|
||||||
[dmdproc.Executable, dmdproc.ExitStatus]), fDoc, amcEdit, amkErr);
|
[dmdproc.Executable, prettyReturnStatus(dmdproc)]), fDoc, amcEdit, amkErr);
|
||||||
fMsgs.message(shortenPath(fDoc.fileName, 25) + ' has not been compiled',
|
fMsgs.message(shortenPath(fDoc.fileName, 25) + ' has not been compiled',
|
||||||
fDoc, amcEdit, amkErr);
|
fDoc, amcEdit, amkErr);
|
||||||
end;
|
end;
|
||||||
|
|
|
@ -80,6 +80,8 @@ type
|
||||||
|
|
||||||
procedure killProcess(var proc: TCEProcess);
|
procedure killProcess(var proc: TCEProcess);
|
||||||
|
|
||||||
|
function prettyReturnStatus(proc: TProcess): string;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
procedure killProcess(var proc: TCEProcess);
|
procedure killProcess(var proc: TCEProcess);
|
||||||
|
@ -92,6 +94,59 @@ begin
|
||||||
proc := nil;
|
proc := nil;
|
||||||
end;
|
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);
|
constructor TCEProcess.create(aOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
|
@ -261,10 +261,21 @@ begin
|
||||||
lst.Free;
|
lst.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if (not fProcess.Running) and fNextToolAlias.isNotEmpty then
|
if (not fProcess.Running) then
|
||||||
|
begin
|
||||||
|
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
|
begin
|
||||||
nxt := fToolItems.findTool(fNextToolAlias);
|
nxt := fToolItems.findTool(fNextToolAlias);
|
||||||
if nxt.isNotNil then nxt.execute(self);
|
if nxt.isNotNil then
|
||||||
|
nxt.execute(self);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$ENDREGION --------------------------------------------------------------------}
|
{$ENDREGION --------------------------------------------------------------------}
|
||||||
|
@ -277,15 +288,16 @@ begin
|
||||||
inherited;
|
inherited;
|
||||||
fTools := TCEToolItems.Create(TCEToolItem);
|
fTools := TCEToolItems.Create(TCEToolItem);
|
||||||
fname := getCoeditDocPath + toolsFname;
|
fname := getCoeditDocPath + toolsFname;
|
||||||
if fname.fileExists then loadFromFile(fname);
|
if fname.fileExists then
|
||||||
//
|
loadFromFile(fname);
|
||||||
|
|
||||||
EntitiesConnector.addObserver(self);
|
EntitiesConnector.addObserver(self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TCETools.destroy;
|
destructor TCETools.destroy;
|
||||||
begin
|
begin
|
||||||
EntitiesConnector.removeObserver(self);
|
EntitiesConnector.removeObserver(self);
|
||||||
//
|
|
||||||
ForceDirectoriesUTF8(getCoeditDocPath);
|
ForceDirectoriesUTF8(getCoeditDocPath);
|
||||||
saveToFile(getCoeditDocPath + toolsFname);
|
saveToFile(getCoeditDocPath + toolsFname);
|
||||||
fTools.Free;
|
fTools.Free;
|
||||||
|
|
Loading…
Reference in New Issue