
On Sun, Dec 9, 2012 at 8:53 PM, Joshua Boyce <raptorfactor@raptorfactor.com>wrote:
On Sun, Dec 9, 2012 at 12:38 PM, Boris Schaeling <boris@highscore.de> wrote:
No escaping of command line arguments anymore with set_args
I'm concerned because under Windows at least, the way that command line arguments are escaped is quite important (and also difficult to get right). Does your library correctly handle all the example cases given in the article below?
http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/ever...
Good article, but its relevance to the scope of this library is doubted. It deals with "the correct way of passing arguments to applications that use CommandLineToArgvW", yet admits that not all applications use this functions and in fact a very frequently used one (cmd.exe) falls within this category. It also describes the way cmd.exe processes quotation marks in the command line *written in the command prompt and batch files*, which is irrelevant to the subject of passing command lines *to* cmd.exe. cmd.exe interprets the quotation marks in its own command line in a different way (from cmd.exe /?): [...] where the following logic is used to process quote (") characters:
1. If all of the following conditions are met, then quote characters on the command line are preserved: [...] 2. Otherwise, old behavior is to see if the first character is a quote character and if so, strip the leading character and remove the last quote character on the command line, preserving any text after the last quote character.
As per Boost.Process, all this means that you cannot get all: 1) passing arbitrary arguments to any application and 2) do it transparently to the user 3) using a uniform interface. As I said, in my opinion, trading 2 for 1 and 3 is the most sensible compromise. -- Yakov