dastworx, prevent some zombie proc,

may cause problem again under win see  e0fa57d8b6
This commit is contained in:
Basile Burg 2016-08-29 11:27:24 +02:00
parent 0b8c3bf093
commit 7d84ab1a04
2 changed files with 27 additions and 18 deletions

View File

@ -51,6 +51,7 @@ begin
prc.Input.Write(str[1], str.length);
prc.CloseInput;
processOutputToStrings(prc, imports);
while prc.Running do ;
finally
prc.free;
end;
@ -74,6 +75,7 @@ begin
prc.Execute;
prc.CloseInput;
processOutputToStrings(prc, results);
while prc.Running do ;
finally
prc.free;
end;

View File

@ -345,6 +345,7 @@ begin
fClient.Parameters.Clear;
fClient.Parameters.Add('-I' + folder);
fClient.Execute;
while fClient.Running do ;
end;
procedure TCEDcdWrapper.addImportFolders(const folders: TStrings);
@ -366,6 +367,7 @@ begin
begin
fClient.Execute;
end;
while fClient.Running do ;
end;
procedure TCEDcdWrapper.getCallTip(out tips: string);
@ -383,6 +385,7 @@ begin
writeSourceToInput;
//
fTempLines.LoadFromStream(fClient.Output);
while fClient.Running do ;
if fTempLines.Count = 0 then
begin
updateServerlistening;
@ -418,6 +421,7 @@ begin
writeSourceToInput;
//
fTempLines.LoadFromStream(fClient.Output);
while fClient.Running do ;
if fTempLines.Count = 0 then
begin
updateServerlistening;
@ -480,6 +484,7 @@ begin
//
comment := '';
fTempLines.LoadFromStream(fClient.Output);
while fClient.Running do ;
if fTempLines.Count = 0 then
updateServerlistening;
for str in fTempLines do
@ -490,12 +495,12 @@ begin
if startsWith('\\') then
begin
comment += '\';
popFront; popFront;
popFrontN(2);
end
else if startsWith('\n') then
begin
comment += LineEnding;
popFront; popFront;
popFrontN(2);
end
end;
comment += LineEnding + LineEnding;
@ -503,8 +508,7 @@ begin
//
comment := ReplaceText(comment, 'ditto' + LineEnding + LineEnding, '');
comment := ReplaceText(comment, 'ditto', '');
comment := TrimLeft(comment);
comment := TrimRight(comment);
comment := Trim(comment);
end;
procedure TCEDcdWrapper.getDeclFromCursor(out fname: string; out position: Integer);
@ -525,21 +529,23 @@ begin
fClient.Execute;
writeSourceToInput;
//
setlength(str, MAX_PATH);
i := fClient.Output.Read(str[1], MAX_PATH);
if i = 0 then
updateServerlistening;
setLength(str, i);
if str.isNotEmpty then
fTempLines.LoadFromStream(fClient.Output);
while fClient.Running do ;
if fTempLines.Count > 0 then
begin
i := Pos(#9, str);
if i = -1 then
exit;
loc := str[i+1..str.length];
fname := str[1..i-1];
loc := ReplaceStr(loc, LineEnding, '');
position := strToIntDef(loc, -1);
end;
str := fTempLines[0];
if str.isNotEmpty then
begin
i := Pos(#9, str);
if i = -1 then
exit;
loc := str[i+1..str.length];
fname := str[1..i-1];
loc := ReplaceStr(loc, LineEnding, '');
position := strToIntDef(loc, -1);
end;
end
else updateServerlistening;
end;
procedure TCEDcdWrapper.getLocalSymbolUsageFromCursor(var locs: TIntOpenArray);
@ -562,6 +568,7 @@ begin
//
setLength(locs, 0);
fTempLines.LoadFromStream(fClient.Output);
while fClient.Running do ;
if fTempLines.Count < 2 then
exit;
str := fTempLines[0];