TProcess.Parameters.Add -> TProcess.Parameters.AddStrings

This commit is contained in:
Basile Burg 2020-07-09 07:34:31 +02:00
parent 1001642f88
commit 446cccbe2a
7 changed files with 21 additions and 62 deletions

View File

@ -1250,8 +1250,7 @@ begin
Result := 0;
proc := tprocess.Create(nil);
proc.Executable := 'ps';
proc.Parameters.Add('-C');
proc.Parameters.Add(ExeName);
proc.Parameters.AddStrings(['-C', Exename]);
proc.Options := [poUsePipes, poWaitonexit];
try
proc.Execute;

View File

@ -132,10 +132,7 @@ begin
fServer.ShowWindow := swoHIDE;
{$ENDIF}
if fCurrentSessionPortNum <> 0 then
begin
fServer.Parameters.Add('--tcp');
fServer.Parameters.Add(fPortAsProcParam);
end;
fServer.Parameters.AddStrings(['--tcp', fPortAsProcParam]);
end;
fTempLines := TStringList.Create;
fImportCache := TStringHashSet.Create;
@ -349,9 +346,7 @@ begin
try
prc.Options:= [poUsePipes, poNoConsole];
prc.Executable := 'netstat';
prc.Parameters.Add('-o');
prc.Parameters.Add('-a');
prc.Parameters.Add('-n');
prc.Parameters.AddStrings(['-o', '-a', '-n']);
prc.Execute;
lst := TStringList.Create;
try
@ -377,10 +372,7 @@ end;
procedure TDcdWrapper.tryAddTcpParams;
begin
if fCurrentSessionPortNum <> 0 then
begin
fClient.Parameters.Add('--tcp');
fClient.Parameters.Add(fPortAsProcParam);
end;
fClient.Parameters.AddStrings(['--tcp', fPortAsProcParam]);
end;
procedure TDcdWrapper.killServer;
@ -499,8 +491,7 @@ begin
terminateClient;
fClient.Parameters.Clear;
tryAddTcpParams;
fClient.Parameters.Add('-c');
fClient.Parameters.Add(intToStr(fDoc.SelStart - 1));
fClient.Parameters.AddStrings(['-c', intToStr(fDoc.SelStart - 1)]);
fClient.Execute;
writeSourceToInput;
@ -551,8 +542,7 @@ begin
terminateClient;
fClient.Parameters.Clear;
tryAddTcpParams;
fClient.Parameters.Add('-c');
fClient.Parameters.Add(intToStr(fDoc.SelStart - 1));
fClient.Parameters.AddStrings(['-c', intToStr(fDoc.SelStart - 1)]);
fClient.Execute;
writeSourceToInput;
@ -617,9 +607,7 @@ begin
terminateClient;
fClient.Parameters.Clear;
tryAddTcpParams;
fClient.Parameters.Add('-d');
fClient.Parameters.Add('-c');
fClient.Parameters.Add(intToStr(i - 1));
fClient.Parameters.AddStrings(['-d', '-c', intToStr(i - 1)]);
fClient.Execute;
writeSourceToInput;
@ -663,9 +651,7 @@ begin
terminateClient;
fClient.Parameters.Clear;
tryAddTcpParams;
fClient.Parameters.Add('-l');
fClient.Parameters.Add('-c');
fClient.Parameters.Add(intToStr(fDoc.SelStart));
fClient.Parameters.AddStrings(['-l', '-c', intToStr(fDoc.SelStart)]);
fClient.Execute;
writeSourceToInput;
@ -700,9 +686,7 @@ begin
terminateClient;
fClient.Parameters.Clear;
tryAddTcpParams;
fClient.Parameters.Add('-u');
fClient.Parameters.Add('-c');
fClient.Parameters.Add(intToStr(fDoc.SelStart - 1));
fClient.Parameters.AddStrings(['-u', '-c', intToStr(fDoc.SelStart - 1)]);
fClient.Execute;
writeSourceToInput;

View File

@ -1589,8 +1589,7 @@ procedure TDubProject.updateImportPathsFromJson;
Executable := exeFullName('dub' + exeExt);
Options := Options + [poUsePipes];
ShowWindow:= swoHIDE;
Parameters.Add('fetch');
Parameters.Add(n);
Parameters.AddStrings(['fetch', n]);
Execute;
while Running do ;
if ExitStatus.equals(0) then
@ -1647,9 +1646,7 @@ procedure TDubProject.updateImportPathsFromJson;
Executable := exeFullName('dub' + exeExt);
Options := Options + [poUsePipes];
ShowWindow:= swoHIDE;
Parameters.Add('fetch');
Parameters.Add(n);
Parameters.Add('--version=' + p);
Parameters.AddStrings(['fetch', n, '--version=' + p]);
Execute;
while Running do ;
if ExitStatus.equals(0) then
@ -1827,16 +1824,7 @@ begin
dub.Executable := 'dub' + exeExt;
dub.Options := [poUsePipes{$IFDEF WINDOWS}, poNewConsole{$ENDIF}];
dub.ShowWindow := swoHIDE;
dub.CurrentDirectory:= filename.extractFilePath;
// need to move because it looks like DUB doesn't use
// the cd specified for the process we launch here.
chdir(dub.CurrentDirectory);
dub.Parameters.Add('convert');
dub.Parameters.Add('-s');
dub.Parameters.Add('-f');
dub.Parameters.Add('json');
dub.Parameters.AddStrings(['convert', '-s', '-f', 'json', '--root='+ filename.extractFilePath]);
dub.Execute;
processOutputToStrings(dub, str);
while dub.Running do;

View File

@ -1981,8 +1981,7 @@ begin
fGdb := TDexedProcess.create(nil);
fGdb.Executable:= gdb;
fgdb.Options:= [poUsePipes, poStderrToOutPut];
fgdb.Parameters.Add(fExe);
fgdb.Parameters.Add('--interpreter=mi');
fgdb.Parameters.AddStrings([fExe, '--interpreter=mi']);
fGdb.OnReadData:= @gdboutQuiet;
fGdb.OnTerminate:= @gdboutJsonize;
fgdb.execute;

View File

@ -468,8 +468,7 @@ begin
dub.Executable:= 'dub';
dub.Options:= [poUsePipes, poStderrToOutPut];
dub.ShowWindow:= swoHIDE;
dub.Parameters.Add('fetch');
dub.Parameters.Add(nme);
dub.Parameters.AddStrings(['fetch', nme]);
if ver = 'master' then
dub.Parameters.Add('--version=~master')
else
@ -520,9 +519,7 @@ begin
dub.Executable:= 'dub';
dub.ShowWindow:= swoHIDE;
dub.Options:= [poUsePipes, poStderrToOutPut];
dub.Parameters.Add('build');
dub.Parameters.Add('--build=release');
dub.Parameters.Add('--force');
dub.Parameters.AddStrings(['build', '--build=release', '--force']);
dub.Parameters.Add('--compiler=' + getCompilerSelector.getCompilerPath(DubCompiler, false));
dub.CurrentDirectory:= pth;
dub.Execute;

View File

@ -3396,8 +3396,7 @@ begin
prc.Executable:=pth;
prc.Options := [poUsePipes, poStderrToOutPut {$IFDEF WINDOWS}, poNewConsole{$ENDIF}];
prc.ShowWindow:= swoHIDE;
prc.Parameters.Add(fDoc.fileName);
prc.Parameters.Add('-S');
prc.Parameters.AddStrings([fDoc.fileName, '-S']);
if not fDscanUnittests then
prc.Parameters.Add('--skipTests');
prc.Execute;
@ -3488,8 +3487,7 @@ begin
fMsgs.message('check menu `Options`, `Compilers Paths`', fDoc, amcEdit, amkHint);
exit;
end;
fRunProc.Parameters.add('--compiler=' + d);
fRunProc.Parameters.Add(fDoc.fileName);
fRunProc.Parameters.AddStrings(['--compiler=' + d, fDoc.fileName]);
fRunProc.execute;
end;
@ -4118,10 +4116,7 @@ begin
fMsgs.message(r[i], fProj, amcProj, amkAuto);
while p.Running do ;
p.Parameters.Clear;
p.Parameters.Add('submodule');
p.Parameters.Add('update');
p.Parameters.Add('--init');
p.Parameters.Add('--recursive');
p.Parameters.AddStrings(['submodule', 'update', '--init', '--recursive']);
p.Execute;
processOutputToStrings(p,r);
while p.Running do ;
@ -4153,8 +4148,7 @@ begin
begin
p.Options := [poUsePipes, poNoConsole, poStderrToOutPut];
p.ShowWindow:= swoHIDE;
p.Parameters.Add('checkout');
p.Parameters.Add(b);
p.Parameters.AddStrings(['checkout', b]);
p.CurrentDirectory:= fProj.basePath;
p.Execute;
processOutputToStrings(p,r);
@ -4195,8 +4189,7 @@ begin
begin
p.Options := [poUsePipes, poNoConsole];
p.ShowWindow:= swoHIDE;
p.Parameters.Add('branch');
p.Parameters.Add('--list');
p.Parameters.AddStrings(['branch', '--list']);
p.CurrentDirectory:= fProj.basePath;
p.Execute;
processOutputToStrings(p,r);

View File

@ -1103,8 +1103,7 @@ begin
fDscanner.Options:=[poUsePipes];
fDscanner.ShowWindow:=swoHIDE;
fDscanner.OnTerminate:=@dscannerTerminate;
fDscanner.Parameters.add('-S');
fDscanner.Parameters.add('stdin');
fDscanner.Parameters.AddStrings(['-S', 'stdin']);
fDscannerResults:= TDscannerResults.create;
fKnowsDscanner := fDscanner.Executable.fileExists;