Here is my code:
-(void)startTask{
NSString * cmd = @"/bin/sh";
pty_ = [[PseudoTTY alloc] init];
NSTask * task = [[NSTask alloc] init];
[task setStandardInput:[pty_ slaveFileHandle]];
[task setStandardOutput:[pty_ slaveFileHandle]];
[task setStandardError:[pty_ slaveFileHandle]];
[task setCurrentDirectoryPath:[@"~" stringByExpandingTildeInPath]];
[task setLaunchPath:@"/bin/sh /applications/jarvis/brain/server.sh"];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(didRead:)
name:NSFileHandleReadCompletionNotification
object:[pty_ masterFileHandle]];
[[pty_ masterFileHandle] readInBackgroundAndNotify];
[task launch];
[self insertText:
[NSString stringWithFormat:@"Started %@ on terminal %@", cmd, [pty_ name]]];
}
But, instead of this, I need it to start an SH file: /applications/brain/server.sh
I'm confused....
Can someone help me with my code?
thanks, Elijah