[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with NSTaskDidTerminateNotification
From: |
Germán Arias |
Subject: |
Re: Problem with NSTaskDidTerminateNotification |
Date: |
Sat, 05 Apr 2014 11:39:20 -0600 |
User-agent: |
GNUMail (Version 1.2.1) |
On 2014-04-05 01:54:08 -0600 Richard Frith-Macdonald <address@hidden> wrote:
>
> On 5 Apr 2014, at 07:50, Germán Arias <address@hidden> wrote:
>
>> On PC if you build a tool that writes more than one line. for example:
>>
>> NSLog(@"One");
>> NSLog(@"Two");
>> NSLog(@"Three");
>>
>> And run this at launch panel, only the first line is printed. The problem
>> is that NSTaskDidTerminateNotification is sent after print the first line,
>> even when Task is still running.
>
> That seems to require a major bug in windows (since the notification is sent
> only after windows says the process has terminated).
Sorry, I forgot say this problem is on my GNU/Linux system. Today I tested this
on Windows, and works perfectly.
>
> More likely something's messing with the output. If you are reading the
> output of the task via a pipe, most like the sequence of events is:
>
> 1. subtask writes three lines to pipe
> 2. parent reads first line and prints it
> 3. subtask terminates
> 4. parent receives notification and closes pipe without reading remaining two
> lines
>
> But I expect there are other possible ways that you could lose buffered
> output when a task ends; I suggest you examine the I/O you are doing.
>
> Another possibility would be if you are launching an intermediate subtask (eg
> a shell which then runs the tool asynchronously) which terminates.
>
> 1. launch the shell subtask
> 2. shell launches the tool
> 3. shell terminates
> 4. parent receives notification
> 5. tool terminates
>
I will check this.
Germán.