mirror of https://gitlab.com/basile.b/dexed.git
diff, prevent zombie proc + leak
This commit is contained in:
parent
e7ca586d77
commit
40505e9a58
|
@ -35,30 +35,37 @@ begin
|
||||||
inherited create(nil);
|
inherited create(nil);
|
||||||
|
|
||||||
p := TProcess.Create(self);
|
p := TProcess.Create(self);
|
||||||
p.Executable:= 'diff' + exeExt;
|
try
|
||||||
|
p.Executable:= 'diff' + exeExt;
|
||||||
|
|
||||||
lbl.Caption:= 'The file: "' + fname2 + '" has been modified by another program.'
|
lbl.Caption:= 'The file: "' + fname2 + '" has been modified by another program.'
|
||||||
+ LineEnding + 'Use the following diff to decide if the content should be '
|
+ LineEnding + 'Use the following diff to decide if the content should be '
|
||||||
+ 'reloaded.';
|
+ 'reloaded.';
|
||||||
|
|
||||||
if exeInSysPath(p.Executable) then
|
if exeInSysPath(p.Executable) then
|
||||||
begin
|
begin
|
||||||
p.Parameters.Add('-u');
|
p.Parameters.Add('-u');
|
||||||
p.Parameters.Add(fname1);
|
p.Parameters.Add(fname1);
|
||||||
p.Parameters.Add(fname2);
|
p.Parameters.Add(fname2);
|
||||||
p.Options:= [poUsePipes];
|
p.Options:= [poUsePipes];
|
||||||
p.ShowWindow:= swoHIDE;
|
p.ShowWindow:= swoHIDE;
|
||||||
p.Execute;
|
p.Execute;
|
||||||
|
|
||||||
r := TStringList.Create;
|
r := TStringList.Create;
|
||||||
try
|
try
|
||||||
processOutputToStrings(p,r);
|
processOutputToStrings(p,r);
|
||||||
editor.Lines.Assign(r);
|
editor.Lines.Assign(r);
|
||||||
finally
|
finally
|
||||||
r.Free;
|
r.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
while p.Running do
|
||||||
|
sleep(1);
|
||||||
|
end
|
||||||
|
else editor.Lines.Add('(The "diff" tool cannot be found)');
|
||||||
|
finally
|
||||||
|
p.Free;
|
||||||
end
|
end
|
||||||
else editor.Lines.Add('(The "diff" tool cannot be found)');
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
Loading…
Reference in New Issue