KProcess overhaul [PATCH]
ralf.habacker at freenet.de
Tue Apr 18 21:55:47 BST 2006
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 <all-arguments-concatenated>", not "shell -c <arg> <arg> ...".
>>>>> 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
> 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
>> 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 ?
More information about the kde-core-devel