mirror of https://gitlab.com/basile.b/dexed.git
dastworx, add error detection from CE side
This commit is contained in:
parent
6966404525
commit
ccb85aa086
|
@ -292,6 +292,8 @@ type
|
||||||
*)
|
*)
|
||||||
function openUrl(const value: string): boolean;
|
function openUrl(const value: string): boolean;
|
||||||
|
|
||||||
|
procedure tryRaiseFromStdErr(proc: TProcess);
|
||||||
|
|
||||||
var
|
var
|
||||||
// supplementatl directories to find background tools
|
// supplementatl directories to find background tools
|
||||||
additionalPath: string;
|
additionalPath: string;
|
||||||
|
@ -1310,6 +1312,20 @@ begin
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure tryRaiseFromStdErr(proc: TProcess);
|
||||||
|
begin
|
||||||
|
if (proc.ExitStatus <> 0) and (poUsePipes in proc.Options) then
|
||||||
|
with TStringList.Create do
|
||||||
|
try
|
||||||
|
LoadFromStream(proc.Stderr);
|
||||||
|
Insert(0, format('tool crashed with code: %d (%s)',
|
||||||
|
[proc.ExitStatus, shortenPath(proc.Executable)]));
|
||||||
|
raise Exception.Create(Text);
|
||||||
|
finally
|
||||||
|
free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
registerClasses([TCEPersistentShortcut]);
|
registerClasses([TCEPersistentShortcut]);
|
||||||
end.
|
end.
|
||||||
|
|
|
@ -34,6 +34,7 @@ end;
|
||||||
|
|
||||||
procedure getModuleImports(source, imports: TStrings);
|
procedure getModuleImports(source, imports: TStrings);
|
||||||
var
|
var
|
||||||
|
err: TStringList;
|
||||||
str: string;
|
str: string;
|
||||||
prc: TProcess;
|
prc: TProcess;
|
||||||
begin
|
begin
|
||||||
|
@ -51,6 +52,8 @@ begin
|
||||||
prc.Input.Write(str[1], str.length);
|
prc.Input.Write(str[1], str.length);
|
||||||
prc.CloseInput;
|
prc.CloseInput;
|
||||||
processOutputToStrings(prc, imports);
|
processOutputToStrings(prc, imports);
|
||||||
|
// TODO-cmaintenance: remove this from version 3 gold
|
||||||
|
tryRaiseFromStdErr(prc);
|
||||||
while prc.Running do ;
|
while prc.Running do ;
|
||||||
finally
|
finally
|
||||||
prc.free;
|
prc.free;
|
||||||
|
@ -75,6 +78,8 @@ begin
|
||||||
prc.Execute;
|
prc.Execute;
|
||||||
prc.CloseInput;
|
prc.CloseInput;
|
||||||
processOutputToStrings(prc, results);
|
processOutputToStrings(prc, results);
|
||||||
|
// TODO-cmaintenance: remove this from version 3 gold
|
||||||
|
tryRaiseFromStdErr(prc);
|
||||||
while prc.Running do ;
|
while prc.Running do ;
|
||||||
finally
|
finally
|
||||||
prc.free;
|
prc.free;
|
||||||
|
|
|
@ -782,6 +782,8 @@ begin
|
||||||
clearTree;
|
clearTree;
|
||||||
updateVisibleCat;
|
updateVisibleCat;
|
||||||
if fDoc.isNil then exit;
|
if fDoc.isNil then exit;
|
||||||
|
// TODO-cmaintenance: remove this from version 3 gold
|
||||||
|
tryRaiseFromStdErr(fToolProc);
|
||||||
//
|
//
|
||||||
fToolProc.OnTerminate := nil;
|
fToolProc.OnTerminate := nil;
|
||||||
fToolProc.OnReadData := nil;
|
fToolProc.OnReadData := nil;
|
||||||
|
|
Loading…
Reference in New Issue