I using Watchman 4.4.0 version and found problem that watchman can monitor only 2 level directory from roots.
So i not sure what going wrong with this ?
Directory Structure
src/<- set watch roots
└── Oncmd
└── Command <- **File under this can't monitor
├── GencmdCommand.php
├── InitCommand.php
└── cmdCommand.php
watchman -- watch-list
{
"version": "4.4.0",
"roots": [
"/home/udomsak/mycmd/src"
]
}
watchman -- trigger-list
{
"version": "4.4.0",
"triggers": [
{
"name": "build_phar",
"append_files": true,
"command": [
"./build.sh"
],
"stdin": [
"name",
"exists",
"new",
"size",
"mode"
],
"expression": [
"anyof",
[
"match",
"*",
"wholename"
]
]
}
]
}
If you run
watchman find /home/udomsak/mycmd/src
and don't see those files in the output, then that is a watchman bug.However, I think I can see what is causing this to not work how you expect.
The
match
expression you're using won't match the/
characters that are present in thewholename
in the way that you expect.You didn't include details on how you established that trigger, so this advice on how to get the behavior it sounds like you're looking for has a couple of different options.
Option 1, since it looks like you want to trigger for any file changing, is simply to remove the expression term completely.
Option 2, use a recursive glob via the expanded wildmatch syntax:
["match", "**/*", "wholename"]
.Option 3, use watchman-make. Rather than use the
trigger
command, it is often significantly easier to usewatchman-make
for this kind of use case: