KProcess and bash arguments

Waldo Bastian bastian at kde.org
Mon Jul 8 18:01:03 BST 2002


On Sunday 07 July 2002 02:44 pm, Jens Zurheide wrote:
> Hi,
>
> during investigating a timing dependent crash of KDevelop-2.1.2 (cvs) I
> found something in
> bool KProcess::start(RunMode runmode, Communication comm)
> that looks strange (and/or I have interpretation problems of the bash
> man-pages). KProcess calls in my case
> 	/bin/sh -c make -f admin/Makefile.common cvs
> but reading the man pages of bash I have the impression that it should be
> 	/bin/sh -c "make -f admin/Makefile.common cvs"
> This means that the result of shellCmd in KProcess::start() should be
> enclosed in double colons.

THe colons are only needed when you type the command from a shell so that the 
shell (in which you type the whole command) knows that: 
	make -f admin/Makefile.common cvs
is the third argument and not argument 3, 4, 5 and 6.

In KProcess you do something like:
process << "/bin/sh" << "-c" << "make -f admin/Makefile.common cvs";
So KProcess knows that this are 3 arguments and not 6. It then passes these 3 
arguments to execvp().

Cheers,
Waldo
-- 
bastian at kde.org  |   SuSE Labs KDE Developer  |  bastian at suse.com





More information about the kde-core-devel mailing list