开发者

NSTask to call command top. Getting Error

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;
argumen开发者_如何学Gots = [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!


It seems as if it was my arguments:

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

Thanks!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜