From kde-core-devel Tue Apr 18 20:55:47 2006 From: Ralf Habacker Date: Tue, 18 Apr 2006 20:55:47 +0000 To: kde-core-devel Subject: Re: KProcess overhaul [PATCH] Message-Id: <44455253.2040603 () freenet ! de> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=114539375816972 Oswald Buddenhagen schrieb: >> I like more to setup relevants options on one place and to use it >> without conditions later , but this could also be implemented in another >> way. :-) >> >> > you can #define C_ARG in an #ifdef, if you like. or you could split the > line and have only the relevant part #ifdef'd. > Yes, forgot to say that I had also in mind that this option could be changed at runtime for example adding -x for shell debugging and so one. But this could be added also later. :-) > >>>>> 2) you botched the command composition. it is >>>>> "shell -c ", not "shell -c ...". >>>>> on windows that does not matter, as everything is more or less simply >>>>> concatenated into one string anyway, but on unix it does. >>>>> >>>>> >>>>> >>>> I don't know how to implement this on unix. >>>> >>>> >>>> >>> you could simly read the old code. >>> honestly, you are scaring me by playing with this stuff. get yourself *a >>> bit* into the topic first, for *all* relevant platforms. >>> >>> >>> >> Hmmh, KProcess::start() and KProcess::execute() a QStringList as >> arguments, so it would be easy to add this support in these methods. >> >> void KProcess::startShell( const QString & program, const QStringList & >> arguments ) >> { >> args = quoteArguments(arguments); >> return start(KProcessPrivate::shell, QStringList() << "/c" << >> program << args ); >> } >> >> >> Additional on windows quoting is already implemented in >> QProcess::execute() and QProcess::start() (see see >> http://doc.trolltech.com/4.1/qprocess.html) >> >> > yes, windows sucks. :) > >> Do you expect a full working solutions for all platforms in this state ? >> >> > well, no. but you should be perfectly clear about the QProcess calls the code > is supposed to produce - and in this case the code is quite trivial once > you know what you want. > Because of that I wrote the unit test from the beginning. It helps me to think about what should work how. For example after your objectivites related to quoting I have add a todo entry for a quoting test , which will check if this really works like expected. :-) >> The executeShell() and startShell() methods are such a proposal, maybe >> it would be better to add this to KShell, which could be the Shell >> Starter class as KShellProcess is recent. >> >> > no, KShell is not about execution, it is about parsing and constructing > shell syntax. > > the bottom line is that execution through a shell is hard to get > portable at all, and once done, the benefits are relatively minor - > sounds like the reason why qt 4 still does not have it. not that i'm > opposed to the idea ... > I recognized this too while writing the unit test. How should we go on ? Ralf