Note that there are some explanatory texts on larger screens.

plurals
  1. PONSTask only returning standardError in release build
    text
    copied!<p>First of all, when debugging and running in Xcode everything works as expected.</p> <p>But when I try to "share" my app, i.e. make a release build, my NSTask won't output any standardOutput while standardErrors ARE put out. How is that possible?</p> <p>My code</p> <pre><code>- (id)initWithWindow:(NSWindow *)window { self = [super initWithWindow:window]; if (self) { // Initialization code here. } [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(readPipe:) name:NSFileHandleReadCompletionNotification object:nil]; return self; } -(void) watchFile:(NSNotification *)notification { NSString *path = [[notification userInfo] valueForKey:@"path"]; task = [[NSTask alloc] init]; [task setLaunchPath:@"/usr/bin/compass"]; [task setCurrentDirectoryPath:path]; NSArray *arguments; arguments = [NSArray arrayWithObjects: @"watch",@"--boring", nil]; [task setArguments: arguments]; NSPipe *outPipe, *errPipe; outPipe = [NSPipe pipe]; errPipe = [NSPipe pipe]; [task setStandardOutput: outPipe]; [task setStandardError: errPipe]; [task setStandardInput: [NSPipe pipe]]; standardHandle = [outPipe fileHandleForReading]; [standardHandle readInBackgroundAndNotify]; errorHandle = [errPipe fileHandleForReading]; [errorHandle readInBackgroundAndNotify]; [self setSplitterPosition:0.0f]; [task launch]; } -(void)readPipe:(NSNotification *)notification { NSLog(@"reading pipe"); NSData *data; NSString *text; if(!([notification object] == standardHandle) &amp;&amp; !([notification object] == errorHandle)) { return; } data = [[notification userInfo] objectForKey:NSFileHandleNotificationDataItem]; text = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding]; if ([data length] == 0) { //error [self setSplitterPosition:150.0f]; return; } [terminalViewController updateTerminal:text]; if(![text isEqualToString:@"\n"]) [self growlAlert:text title:@"Compapp"]; [text release]; if(task) [[notification object] readInBackgroundAndNotify]; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload