I have a cocoa app and I want to launch a shell script that launches Node.js. I figured I would do that with NSTask
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath:@"/bin/bash/start.sh"];
[task setArguments:[NSArray arrayWithObjects:@"start.sh", nil]];
[task setStandardOutput:[NSPipe pipe]];
[task setStandardInput:[NSPipe pipe]];
[task launch];
The script is in the root of my application. I have tried many variations in the launch path and I am stuck. Any help would be greatly appreciated!
Edit:
Here is my new code where i set the argument. It still will not work for some reason.
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath:@"/bin/bash"];
[task setArguments:[NSArray arrayWithObjects:[[NSBundle mainBundle] pathForResource:@"start" ofType:@"sh"], nil]];
[task launch];