WatchPaths Indicator of triggering path?
Hi, When an agent is run as the result of a watched path being modified, does launchd provide the agent with the path that triggered it? For example, imagine that I have the following plist which identifies 3 watchpaths: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd "> <plist version="1.0"> <dict> <key>Label</key> <string>com.example.test</string> <key>ProgramArguments</key> <array> <string>/Users/tester/patchWatcher.pl</string> </array> <key>WatchPaths</key> <array> <string>/some/path</string> <string>/return/of/the/path</string> <string>/revenge/of/path</string> </array> </dict> </plist> Is there some way that launchd tells my program which of the 3 watch paths triggered the event? Is there some hidden "%s" program argument or something like that. I checked the environment variables and didn't see anything. I checked the man pages and couldn't find anything. Second, hopefully easier question: Do the terms "launch services" and "launchd" refer to the same thing? Thanks, Ben Burke
On Aug 12, 2008, at 11:36 PM, Benjamin Burke wrote:
When an agent is run as the result of a watched path being modified, does launchd provide the agent with the path that triggered it? For example, imagine that I have the following plist which identifies 3 watchpaths: [...] <key>WatchPaths</key> <array> <string>/some/path</string> <string>/return/of/the/path</string> <string>/revenge/of/path</string> </array>
No, I don't think the path that triggered the launch is communicated to the process. Seems like a reasonable enhancement request, but the files may be modified after the process is launched and it's the agent's responsibility to watch for that.
Second, hopefully easier question: Do the terms "launch services" and "launchd" refer to the same thing?
LaunchServices refers to the high level framework for opening applications and documents with applications. On Leopard, LaunchServices uses launchd to create new processes. - Kevin
On Aug 13, 2008, at 3:37 AM, Kevin Van Vechten wrote:
On Aug 12, 2008, at 11:36 PM, Benjamin Burke wrote:
When an agent is run as the result of a watched path being modified, does launchd provide the agent with the path that triggered it? For example, imagine that I have the following plist which identifies 3 watchpaths [...]
No, I don't think the path that triggered the launch is communicated to the process. Seems like a reasonable enhancement request, but the files may be modified after the process is launched and it's the agent's responsibility to watch for that.
Thanks. I finally got around to submitting this as an enhancement request (radar #6156218). I tried to come up with a patch myself, but I keep crashing in job_start_child... I'm afraid that I'm a bit out of my depth at the moment.
participants (2)
-
Benjamin Burke
-
Kevin Van Vechten