title: Is there any way to run two or more NSTasks?
body: <p>You can run a script in a Cocoa application using the wonderful <a href="http://www.cocoadev.com/index.pl?NSTask" rel="nofollow noreferrer"><code>NSTask</code></a>, 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.</p>
  
  <p>The issue is that apparently you can only run one <code>NSTask</code> 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 <code>NSTask</code> that I run. <a href="https://stackoverflow.com/questions/2846747/nstask-executed-only-once">This problem has come up before</a>, although less directly, and there has seemingly been no solution.</p>
  
  <p>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".</p>
  
  <p>Here's an example of how I'm running an NSTask, in case it helps.</p>
  
  <pre><code>NSTask *task;
  task = [NSTask launchedTaskWithLaunchPath: @"/bin/bash"
                                  arguments:[NSArray arrayWithObjects: scriptPath, nil]
          ];
  </code></pre>
  
  <p>It is indeed working for all of my scripts individually, it just can't run one then another.</p>