[launchd-dev] WatchEvents and unlink

Alfred Labrie alfred.labrie at gmail.com
Wed Mar 17 07:03:55 PDT 2010


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.


More information about the launchd-dev mailing list