views:

29

answers:

1

Hello super-intelligent people!

Thanks so much for checking out my post.

Right now I'm running this:

NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath: @"/usr/bin/top"];

NSArray *arguments;
arguments = [NSArray arrayWithObjects: @"-stats", @"pid,cpu", nil];
[task setArguments: arguments];

NSPipe *pipe;
pipe = [NSPipe pipe];
[task setStandardOutput: pipe];
//The magic line that keeps your log where it belongs
[task setStandardInput:[NSPipe pipe]];

NSFileHandle *file;
file = [pipe fileHandleForReading];

[task launch];

and it is giving me the error:

 Error opening terminal: unknown.

Any clues? Thanks again!

A: 

It seems as if it was my arguments:

arguments = [NSArray arrayWithObjects: @"-s", @"1",@"-l",@"3600",@"-stats",@"pid,cpu,time,command", nil];

Thanks!

Eric Brotto