【发布时间】:2019-01-15 22:51:38
【问题描述】:
我在 bash 下的 Linux 上使用 Facebook watchman 来跟踪文件系统 变化。
我对如何获取更改 JSON 对象感到困惑。所有我似乎 get 是已更改文件的列表。我将手表和触发器设置为 下面:
watchman watch /Users/osx/Applications/docker/tests watchman --
trigger /Users/osx/Applications/docker/tests 'file-sync' \
-- /Users/osx/Applications/docker/filewatcher/file-sync.sh
但是,当我查询过去到 file-sync.sh 脚本的参数时,它 看起来只是一个文本字段而不是 JSON 对象。
我是否需要做任何其他事情才能真正获得所有的详细信息 根上发生的变化?
watchman trigger-list shows the following results: { "version":
"4.9.0", "triggers": [
{
"command": [
"/Users/osx/Applications/docker/filewatcher/file-sync.sh"
],
"stdin": [
"name",
"exists",
"new",
"size",
"mode"
],
"append_files": true,
"name": "file-sync",
"empty_on_fresh_instance": true
} ] }
据我了解,这应该给我一个 JSON 对象 名称、存在、新、大小和模式组件。
在系统日志中我可以看到以下内容:
2019-01-15T22:28:49,191: [trigger file-sync
/Volumes/UserData/osx/Applications/docker/tests] input_json: sending
json object to stm
什么是stm?
在系统日志中我可以看到以下内容:
2019-01-15T22:28:49,191: [trigger file-sync
/Volumes/UserData/osx/Applications/docker/tests] input_json: sending
`enter code here`json object to stm
在我的 bash 脚本中,我使用 jq 将 JSON 输出转储到标准输出
$(echo jq '.' $1)
【问题讨论】:
标签: watchman