You are not logged in.

Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

DexterMagnific

Unregistered

1

Monday, April 26th 2004, 10:48am

Problem with KPRocIO

Hi,

I'd like to run a sequence like this
cat /proc/stats | grep processes | cut -f 2 -d " "

with KProcIO.

KProcIO Proc();
Proc << "cat /proc/stats | grep processes | cut -f 2 -d \" \""

this doesn't work

Proc << "cat" << "/proc/stats" << "| grep processes" << "| cut -f 2 -d \" \""

also doesn't work

even

Proc << "echo Hello" doesn't work.

but

Proc << "echo" << "Hello" works.

How can i run such a command line in order to get its result via stdout ?

Thanks.

e8johan

Beginner

Posts: 27

Location: Sweden

  • Send private message

2

Monday, April 26th 2004, 11:55am

RE: Problem with KPRocIO

Just a guess:

Proc << "cat" << "/proc/stats" << "|" << "grep" << "processes" << "|" << "cut" << "-f" << "2" << "-d" << " ";

DexterMagnific

Unregistered

3

Monday, April 26th 2004, 1:15pm

RE: Problem with KPRocIO

Sorry but that doesn't work too.

dfaure

Beginner

Posts: 16

Location: France

  • Send private message

4

Wednesday, April 28th 2004, 6:21pm

RE: Problem with KPRocIO

proc.setUseShell(true)
and use the all-in-one-string variant IIRC.
David Faure, KDE developer, Klaralvdalens-Datakonsult AB.