QProcess vs K3Process

Simon Hausmann hausmann at kde.org
Mon May 28 17:56:14 BST 2007


On Monday 28 May 2007 17:45:52 Andreas Pakulat wrote:
> On 28.05.07 16:59:55, Simon Hausmann wrote:
> > On Monday 28 May 2007 16:19:43 Andreas Pakulat wrote:
> > > On 28.05.07 14:26:41, Oswald Buddenhagen wrote:
> > > > On Mon, May 28, 2007 at 03:34:32AM +0200, Andreas Pakulat wrote:
> > > > > I'd like to know wether its better to port KDevelop4 to QProcess
> > > > > usage now or stick with K3Process until KProcess (as a QProcess
> > > > > subclass) is available.
> > > >
> > > > dunno. i could commit a basic KProcess today.
> > >
> > > What I was thinking of is, if KProcess goes into existence sometime
> > > with at least the features of K3Process that are commonly used (that is
> > > env-setting and the way of starting processes and adding the commands)
> > > we could avoid the 2 portings (now to QProcess and then to KProcess).
> > > OTOH Matt wants a port to QProcess rather sooner than later, so I guess
> > > I'll do the port. Also that will enable us to properly parse QProcess
> > > output wrt. lineendings.
> > >
> > > > this is a list of missing [KQ]Process features and differences
> > > > between qproc and k3proc. please comment on the desirability of the
> > > > particular points.
> > > >
> > > > - qproc does not allow setting individual env vars, only the entire
> > > >   environment. pretty inconvenient, if you ask me. can be easily
> > > >   implemented in kproc.
> > >
> > > Yes, thats something I'd like to have again.
> >
> > You can achieve this simply using
> >
> > QProcess proc = ...
> >
> > QStringList env = QProcess::systemEnvironment();
> > env.append("FOO=bar");
> > proc.setEnvironment(env);
>
> Well, normally in KDevelop you'll change existing env vars like PATH,
> KDEDIRS, LD_LIBRARY_PATH and others. I can do this in KDevelops "execute
> foo"-class manually but I'd really prefer a map instead of a stringlist
> in (QK)Process because its just easier to handle.
>
> Also can I assume that QProcess expands variables before executing the
> application based on your statement? I didn't find anythin in QProcess
> documentation about this (and I don't think I should need to lookup
> exec() to find out wether it will expand variables or not)

No, it doesn't do anything like that by itself. Also note that expansion is 
different between Unix and Windows. There may also be behavioural 
differences, but the most obvious difference is that while it's 
PATH=$PATH:/foo/bar it is PATH=%PATH%;/foo/bar in cmd.exe (note the % and the 
semicolon as separator).


Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070528/8fb2b42a/attachment.sig>


More information about the kde-core-devel mailing list