[fpc-devel] TProcess empty parameter

Michael Van Canneyt michael at freepascal.org
Thu May 7 11:39:52 CEST 2015



On Tue, 5 May 2015, Alfred wrote:

> Thanks for your answer !
>
> To be honest, I do not know exactly what to do to solve this problem.
>
> If I look at the source of TProcess, a lot of thing are done with the 
> parameters.
> The parameters are parsed into a list. And again converted into a PCharList.
> And some info is lost during these conversions.

That is only if you use the CommandLine property.
If you use the stringlist (Parameters), no parsing is done. 
Each parameter must be a separate item in the list.

>
> The (unix) command involved is:
> Exe='svn';
> Cmd:='checkout --username "ausername" --password "" -r HEAD remoterepo 
> localrepo';
> ExecuteCommand(Exe+' '+Cmd,....);
>
> As the command itself is a single string, I do not understand why all 
> parameters are split and then combined again. In all conversions, the empty 
> password string is lost when using ExecuteCommand from the processutils unit.

I don't know what code you are looking at but the unix version of TProcess uses ExecVE.

>
> In my search, I came across StrPas and StrNew, and found out that they return 
> nil for empty string, as opposed to Delphi. But again, I do not know if this 
> has something to do with this empty string problem.
>
> As a workaround fpcup now uses: fpSystem(Exe+' '+Command);
> But I have to use some trickery to get the output from this command.
> I would prefer to use ExecuteCommand on all architectures.

Where did you find this ExecuteCommand ? It's definitely not in FPC.

Michael.



More information about the fpc-devel mailing list