Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <pre><code>[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(readPipe:) name: NSFileHandleReadCompletionNotification object: [[task standardOutput] fileHandleForReading]]; [[[task standardOutput] fileHandleForReading] readInBackgroundAndNotify]; </code></pre> </blockquote> <p>You're assuming that the pipe will return the same NSFileHandle object both times.</p> <p>If it doesn't, then the object that posted the notification and the object you're observing for won't be the same object. That would explain why you're not seeing the notification, so I wouldn't count on that.</p> <p>Try getting the NSFileHandle separately and assigning it to a variable, then using the variable in both the <code>addObserver:selector:name:object:</code> and <code>readInBackgroundAndNotify</code> message expressions.</p> <blockquote> <pre><code>[task waitUntilExit]; </code></pre> </blockquote> <p>You're blocking your UI until the task is done. <code>waitUntilExit</code> should be considered harmful, for that reason at least, and probably others.</p> <p><code>waitUntilExit</code> uses the run loop, so I'm moderately surprised if the window isn't getting a chance to draw while it waits, but it's worth changing anyway, both as a potential fix (if indeed that is the problem) and because blocking the UI is bad in itself.</p> <p>Consider observing for <code>NSTaskDidTerminateNotification</code> (which you should set up before you launch) instead. You can post your own notification when that notification arrives.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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