[fpc-devel] TProcess and arguments with quotes

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Wed Sep 5 12:01:39 CEST 2012



On Wed, 5 Sep 2012, Martin wrote:

> On 05/09/2012 10:38, Martin wrote:
>> 
>> function RunCommand(const cmdline:string;var outputstring:string):boolean; 
>> deprecated;
>
> Sorry seen to late, it is deprecated...
>
> Seems that FPC is missing the functionality for "commandline" (which is a 
> property that existed for very long). Seen that it is now deprecated probably 
> means there are no plans to implement it?

Correct.

>
> However the reason
> On 05/09/2012 10:00, Marco van de Voort wrote:
>> The reason why tprocess changed to a list is to avoid the need to 
>> concatenate arguments (and thus split them again). So in time it is 
>> urgently recommended to follow that.
>
> does not explain the lack of a working command line property. For code that 
> has already individual params, the new Parameters[] property could live 
> together with a fully implemented commandline.

The reason we want to get rid of the commandline is EXACTLY what you are
experiencing. The quoting rules, which are non-existent and application
specific on Windows, and which cause nothing but problems on Unix because
most people do not understand them.

To avoid these, we switched to Parameters. They have the benefit of a simple
use, and it is easier to 'imitate' windows using the unix Argv paradigm than
vice versa. Namely: it avoids parsing.

>
> Assuming, that there are many apps that have a single string, IMHO it would 
> be a good idea to add this functionality in fpc.

It will not be added to TProcess. 
On the contrary: CommandLine is marked deprecated becase it will disappear.

I have explained what to do, I will check if the documentation needs
some enhancements. But you must use parameters correctly.

Michael.



More information about the fpc-devel mailing list