title: NSTask NSPipe - objective c command line help
body: <p>Here is my code:</p>
  
  <pre><code>task = [[NSTask alloc] init];
  [task setCurrentDirectoryPath:@"/applications/jarvis/brain/"];
  [task setLaunchPath:@"/applications/jarvis/brain/server.sh"];
  
  NSPipe * out = [NSPipe pipe];
  [task setStandardOutput:out];
  
  [task launch];
  [task waitUntilExit];
  [task release];
  
  NSFileHandle * read = [out fileHandleForReading];
  NSData * dataRead = [read readDataToEndOfFile];
  NSString * stringRead = [[[NSString alloc] initWithData:dataRead encoding:NSUTF8StringEncoding] autorelease];
  </code></pre>
  
  <p>So I'm trying to replicate this:</p>
  
  <pre><code>cd /applications/jarvis/brain/
  ./server.sh
  </code></pre>
  
  <p>but using NSTask in objective-c. </p>
  
  <p>For some reason though, when I run this code, stringRead, returns nothing. It should return what terminal is returning when I launch the .sh file. Correct?</p>
  
  <p>Any ideas?</p>
  
  <p>Elijah</p>