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

View File

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