QProcess vs K3Process

Oswald Buddenhagen ossi at kde.org
Thu Jun 7 00:24:20 BST 2007


On Thu, Jun 07, 2007 at 12:06:50AM +0200, Thiago Macieira wrote:
> Oswald Buddenhagen wrote:
> > really, what's wrong with setenv? not in theory, but in practice?
> 
> setEnv looks like setEnvironment. Users could be confused about what
> one does and what the other does.
> 
i think it is reasonable to assume that most users of this function will
have some basic experience with setenv().

> I'd actually prefer this were called something else. There's also
> putenv that you could inspire on.
> 
great idea - same name, different function.

> >> Because removing the environment from a QStringList can be done a
> >> lot faster than the special cases you've come up with.
> >
> >oh?
> 
> A simple function that removes the entry from the list is faster than
> one that adds-or-removes entries.
> 
errm, you argue the speed of one 'if' in a function that does a linear
search over a string list? ;)

> >> And you could remove the special behaviour of handling null
> >> QStrings differently from empty-but-not-null QStrings.
> >
> >no, because that would be an api change. so it is either changed now
> >or never => no effect on the inline.
> 
> It wouldn't be without precedent that null and empty-but-not-null
> would be treated differently. But it's best to avoid such cases.
> 
this still does not prove anything against inline.
these semantics are inspired by putenv() - see, putenv is already a
source of inspiration. :-P
oh, well, long live code duplication.

> Oh, c'mon, just make your documentation better. Don't argue with
> enhacing documentation.
> 
that only holds if you assume more == better.

> >> Besides, I do think that the following is more readable:
> >> >> Suggestion:
> >> >>     if (env.isEmpty() && value.isNull())
> >> >>         env.append(QLatin1String(DUMMYENV)));
> >> >>     else if (!value.isNull())
> >> >>         env.append(fname.append(value));
> >
> >see, i think exactly the opposite. instead of two separate statements we
> >now have a compound statement with duplicated conditions. it costs me a
> >lot more time to parse this.
> 
> You had two separate statements with a label in the middle.
>
well exactly - because it is two separate things.

> >> Well, we'll just have to have one of the Windows guys fix it.
> >
> >obviously. i'd prefer it if one of them would speak up now, though. oh,
> >well, they'll notice when it says "error: ...". :)
> 
> It would be best if you called:
>   if (shell.isEmpty)
>       shell = qgetenv("COMSPEC");
>
that's a bit like using $SHELL on unix, which is exactly what i don't
want. so while it might turn out to be the only realistic solution, it is
not the best one theoretically.

>   QProcess::start(QString::fromLatin1("%1 /c %2")
>                   .arg(shell, cmd));
> 
> when the program were run, instead of trying to split into a QStringList.
> 
QProcess parses that string according to own rules and from then on
handles it like the string+stringlist variant. i don't think that would
help us. anyway, the windoze guys need to find out what the shells can
do in the first place - maybe the quoting discussion turns out to be
pointless in the first place.

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.




More information about the kde-core-devel mailing list