GithubHelp home page GithubHelp logo

watchman -j hanging about watchman HOT 7 CLOSED

facebook avatar facebook commented on April 23, 2024
watchman -j hanging

from watchman.

Comments (7)

wez avatar wez commented on April 23, 2024

Hard to say without more info. Have you checked your logs?
https://facebook.github.io/watchman/docs/troubleshooting.html#where-are-the-logs

If you're on Linux, running strace watchman -f ... might be useful.
If you're on OSX things are more of a PITA because the debugging tools require you to be root. You can try attaching to the watchman client process; for example:

wez@wez-mbp ~
22:53 $ ps -ef | grep watchman
2048904527  6697     1   0 10:53PM ??         0:00.86 /usr/local/Cellar/watchman/3.0.0/bin/watchman --foreground --logfile=/var/tmp/.watchman.wez.log --sockname=/var/tmp/.watchman.wez --statefile=/var/tmp/.watchman.wez.state
2048904527  6711 28715   0 10:54PM ttys001    0:00.01 watchman -j
2048904527  6713  6634   0 10:54PM ttys002    0:00.00 grep --color=auto watchman
wez@wez-mbp ~
22:54 $ sudo lldb -p 6711
Password:
Attaching to process with:
    process attach -p 6711
Process 6711 stopped
Executable module set to "/usr/local/bin/watchman".
Architecture set to: x86_64-apple-macosx.
(lldb) bt
* thread #1: tid = 0xc00637, 0x00007fff943f7306 libsystem_kernel.dylib`read$NOCANCEL + 10, queue = 'com.apple.main-thread, stop reason = signal SIGSTOP
    frame #0: 0x00007fff943f7306 libsystem_kernel.dylib`read$NOCANCEL + 10
    frame #1: 0x00007fff94397966 libsystem_c.dylib`_sread + 16
    frame #2: 0x00007fff94396f6b libsystem_c.dylib`__srefill1 + 24
    frame #3: 0x00007fff94397088 libsystem_c.dylib`__srget + 14
    frame #4: 0x00007fff94390574 libsystem_c.dylib`fgetc + 52
    frame #5: 0x000000010df5642b watchman`stream_get + 59
    frame #6: 0x000000010df55499 watchman`lex_scan + 73
    frame #7: 0x000000010df54f0f watchman`parse_json + 31
    frame #8: 0x000000010df551a1 watchman`json_loadf + 161
    frame #9: 0x000000010df4d562 watchman`main + 658
    frame #10: 0x000000010df41284 watchman`start + 52
(lldb)

You should make sure that you are sending valid JSON in; if I try running the command you pasted, substituting a local path, I get this:

$ watchman -j <<-EOT
heredocd> ["trigger", "/tmp/foo", {
heredocd>   "name": "assets",
heredocd>   "expression": ["pcre", "\.(js|css|c|cpp)$"],
heredocd>   "command": ["make"]
heredocd> }]
heredocd> EOT
failed to parse JSON from stdin: invalid escape near '"\.'

(I'm using zsh, so it may be something to do with my shell vs. your shell)

from watchman.

0xqd avatar 0xqd commented on April 23, 2024

@wez thanks for your information, I would try to use strace if I can find anything.

I do use zsh too, and I have the same problem you had with invalid escape. And the script I use is the one from the official documentation. Maybe it needs some changes.

https://facebook.github.io/watchman/docs/cmd/trigger.html

from watchman.

0xqd avatar 0xqd commented on April 23, 2024

It's the problem of the expression. Btw, this is a bit off topic but does watchman support multiple triggers configuration through stdin. The one I have tried but it doesn't work :

["triggers": [
  {
    "name": "js_builder",
    "expression": [
      "match",
      "*.js",
      "wholename"
    ],
    "command": [
      "echo",
      "something"
    ]
  },
  {
    "name": "css_builder",
    "expression": [
      "match",
      "*.css",
      "wholename"
    ],
    "command": [
      "echo",
      "css builder"
    ]
  }
]]

from watchman.

wez avatar wez commented on April 23, 2024

We should tweak the docs to escape that backslash.

Regarding two triggers in one invocations, you can send in two trigger commands, one after the other:

["trigger", ...]
["trigger", ...]

Make sure that you handle errors as appropriate to your use case.

from watchman.

0xqd avatar 0xqd commented on April 23, 2024

awesome, thanks for your help !

from watchman.

pardha-billa avatar pardha-billa commented on April 23, 2024

I am new to wathman. I am using zsh. I think I didn't install watchman correctly in my Ubuntu. Can anybody help me.
I am getting following error while using watchman

zsh: command not found: watchman

from watchman.

wez avatar wez commented on April 23, 2024

@pardha-billa please open a new issue; be sure to include what you tried and the errors you're seeing

from watchman.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.