[fpc-devel] TProcess and arguments with quotes

Marco van de Voort marcov at stack.nl
Wed Sep 5 11:44:59 CEST 2012

In our previous episode, Martin said:
> > On non-windows, each element in the params list is passed as-is in the 
> > argv
> > array; No changes are performed at all.
> FPC itself supplies a function
> function RunCommand(const cmdline:string;var 
> outputstring:string):boolean; deprecated;
> it uses TProcess.CommandLine
> using this function, how do I run the following: (example in shell style)
> gdb -i mi -eval-command="set disassembly-flavor intel"

Why do you think this new function was added _deprecated_ ? :-)

The commandline_is_a_single string variants of TProcess are deprecated and
do not support cornercases wrt quoting. And this is one.

Use the separate arguments facility.

(p.s. it was added despite being deprecated to add in the conversion
process. Too many people were trying to do basic piping with the "short"
output tprocess template, and I wanted to have a good one in the field to
stop the copy-and-pasting)

More information about the fpc-devel mailing list