[Development] [Interest] Executing PowerShell command with quotes using QProcess

Thiago Macieira thiago.macieira at intel.com
Thu Apr 3 03:29:59 CEST 2014


Em qui 03 abr 2014, às 08:34:20, Sze Howe Koh escreveu:
> > There's a comment in qprocess.cpp that reads:
> >     // handle quoting. tokens can be surrounded by double quotes
> >     // "hello world". three consecutive double quotes represent
> >     // the quote character itself.
> > 
> > I don't know whose idea it was to use three quotes successively to
> > indicate a
> > quote character. It doesn't work on a regular Unix shell:
> > 
> > $ echo """hello"""
> > hello
> > 
> > Nor on Windows's prompt:
> > C:\>echo """hello"""
> > """hello"""
> > 
> > That commit has been there since the Qt public history started. It's even
> >
> > documented as such (I had to look it up, I didn't know):
> >         http://qt-project.org/doc/qt-5/qprocess.html#start-3
> >
> > But I don't know why it was done like that. It's highly surprising. If it
> > weren't documented, I'd be tempted to just change behaviour and go for
> > standard backslashing.
> 
> That's highly unintuitive. The fact that it's Windows-only suggests
> that it was put in to work around some issue (which may not be present
> in modern versions of Windows). Candidate for change in Qt 6?

I'm not even sure it's Windows-only. I'd like to know the motivation for 
triple-quoting.

But yes, this is a candidate for behaviour change. At the latest, Qt 6. But if 
we could somehow justify it, we should do it even earlier.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list