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;
|
||||
|
||||
procedure tryRaiseFromStdErr(proc: TProcess);
|
||||
|
||||
var
|
||||
// supplementatl directories to find background tools
|
||||
additionalPath: string;
|
||||
|
@ -1310,6 +1312,20 @@ begin
|
|||
{$ENDIF}
|
||||
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
|
||||
registerClasses([TCEPersistentShortcut]);
|
||||
end.
|
||||
|
|
|
@ -34,6 +34,7 @@ end;
|
|||
|
||||
procedure getModuleImports(source, imports: TStrings);
|
||||
var
|
||||
err: TStringList;
|
||||
str: string;
|
||||
prc: TProcess;
|
||||
begin
|
||||
|
@ -51,6 +52,8 @@ begin
|
|||
prc.Input.Write(str[1], str.length);
|
||||
prc.CloseInput;
|
||||
processOutputToStrings(prc, imports);
|
||||
// TODO-cmaintenance: remove this from version 3 gold
|
||||
tryRaiseFromStdErr(prc);
|
||||
while prc.Running do ;
|
||||
finally
|
||||
prc.free;
|
||||
|
@ -75,6 +78,8 @@ begin
|
|||
prc.Execute;
|
||||
prc.CloseInput;
|
||||
processOutputToStrings(prc, results);
|
||||
// TODO-cmaintenance: remove this from version 3 gold
|
||||
tryRaiseFromStdErr(prc);
|
||||
while prc.Running do ;
|
||||
finally
|
||||
prc.free;
|
||||
|
|
|
@ -782,6 +782,8 @@ begin
|
|||
clearTree;
|
||||
updateVisibleCat;
|
||||
if fDoc.isNil then exit;
|
||||
// TODO-cmaintenance: remove this from version 3 gold
|
||||
tryRaiseFromStdErr(fToolProc);
|
||||
//
|
||||
fToolProc.OnTerminate := nil;
|
||||
fToolProc.OnReadData := nil;
|
||||
|
|
Loading…
Reference in New Issue