[launchd-dev] WatchEvents and unlink

dreamcat four dreamcat4 at gmail.com
Tue Mar 23 09:52:13 PDT 2010


Hi,
WatchPaths has always been a little bit touchy / unpredictable. But
not unsolvable.

Maybe you would have better luck to make the WatchPath the parent Dir,
and not the file itself. Then then that file got deleted it wouldnt
matter so much. And if you don't wish to watch other files within the
same enclosing directory, then how about creating an alternate path,
and just symlinking only the one file you are interested in?

I don't have any answer for your question, except to go search in the
Launchd source code. But personally I wouldn't waste your time if you
can just bjork the thing into working with these other tactics.

On Tue, Mar 23, 2010 at 4:24 PM, Alfred Labrie <alfred.labrie at gmail.com> wrote:
> Hello
>
> I am sorry to "bump" but I am really wondering if it is normal behavior.
>
> Please help.
>
> A.
>
>
> On Wed, Mar 17, 2010 at 3:03 PM, Alfred Labrie <alfred.labrie at gmail.com> wrote:
>> Hello
>>
>> It sounds like there is a new behavior with WatchEvents on Snow Leopard.
>>
>> Let's say, I watch for this file path: "/private/tmp/watch"
>> - if I create the file, launch daemon is triggered
>> - if I write + close the file, launch daemon is triggered
>> - if I remove the file then I create a new file, launch daemon is no
>> longer triggered
>>
>> On Leopard, remove then create the file would trigger the launch daemon.
>>
>> Typical watch.plist syntax would be:
>> ...
>> <dict>
>>        <key>KeepAlive</key>
>>        <false/>
>>        <key>Label</key>
>>        <string>inc.ninja.watch</string>
>>        <key>ProgramArguments</key>
>>        <array>
>>                <string>/path/to/execute</string>
>>        </array>
>>        <key>WatchPaths</key>
>>        <array>
>>                <string>/private/tmp/watch</string>
>>        </array>
>> </dict>
>> </plist>
>>
>> This is tested on Mac OS X 10.6.2 and above. Is it by design or is it a bug?
>>
>> Regards.
>>
> _______________________________________________
> launchd-dev mailing list
> launchd-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev
>


More information about the launchd-dev mailing list