You can run a script in a Cocoa application using the wonderful NSTask
, and it works great. The only issue is that I need to run multiple scripts, and in my application, the scripts cannot be combined into one file or one call -- they must be run as separate tasks by the application.
The issue is that apparently you can only run one NSTask
in an application. I do not understand why this is the case, but sadly, it seems to be. I have tried everything to debug it, but no matter what the script, how simple or how complicated, my application simply will only execute the first NSTask
that I run. This problem has come up before, although less directly, and there has seemingly been no solution.
There has to be a way to run more than one script in an application. Does anyone know a way that I can get around this, or possibly an alternate way to run a script? All I need to do is run a very short bash script that does a "make install".
Here's an example of how I'm running an NSTask, in case it helps.
NSTask *task;
task = [NSTask launchedTaskWithLaunchPath: @"/bin/bash"
arguments:[NSArray arrayWithObjects: scriptPath, nil]
];
It is indeed working for all of my scripts individually, it just can't run one then another.