You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Watchman should escape color codes in environment variables before logging them #47
Some of my environment variables contain ASCII color codes (notably, the LESS_TERMCAP_* variables). Watchman logs these, along with other environment variables, when a file trigger is activated, but doesn't seem to escape them, which results in entire blocks of the log output being displayed in random colors when I tail the log. Here's an example of a problematic log line which triggers a color change:
So my use case is to scp a jar file to a server every time it's successfully built. I want to see whether that is happening correctly, and as a quick solution, I simply tail the watchman log (while scp -v is set, so that I can see what the command is up to). I guess that's not the idiomatic way to do things, and that I should write a command that handles its own logging instead?
One of the things that people find awkward about triggers is that they are headless and continue running even when your terminal session is over. This is a feature but is a bit different from most of the other watchers out there.
One of the things on my mental TODO (although I could have sworn I had it transcribed in an issue here) is to have a session-oriented trigger mode, where you would do something like:
$ watchman fg-trigger <pattern> -- <command>
and that process would subscribe to the watchman service and spawn in your terminal session whenever matching files are changed. It could then log that it was running. Pressing CTRL-C would stop it from triggering, just like a regular unix command.
Since we don't have this today, another suggestion for you is to write a little wrapper script around the log subscriber command:
Activity
wez commentedon Aug 6, 2014
The log is there primarily to figure out what is broken, and I'd rather avoid stripping for two reasons:
Tailing the log file should be a rare event; is there something that is causing you to do this frequently?
mganjoo commentedon Aug 6, 2014
So my use case is to scp a jar file to a server every time it's successfully built. I want to see whether that is happening correctly, and as a quick solution, I simply tail the watchman log (while scp -v is set, so that I can see what the command is up to). I guess that's not the idiomatic way to do things, and that I should write a command that handles its own logging instead?
wez commentedon Aug 6, 2014
One of the things that people find awkward about triggers is that they are headless and continue running even when your terminal session is over. This is a feature but is a bit different from most of the other watchers out there.
One of the things on my mental TODO (although I could have sworn I had it transcribed in an issue here) is to have a session-oriented trigger mode, where you would do something like:
and that process would subscribe to the watchman service and spawn in your terminal session whenever matching files are changed. It could then log that it was running. Pressing CTRL-C would stop it from triggering, just like a regular unix command.
Since we don't have this today, another suggestion for you is to write a little wrapper script around the log subscriber command:
or do something a bit more fancy to munge and format the json records as you prefer. You can play with the log level to adjust verbosity.
mganjoo commentedon Aug 7, 2014
That makes sense. The log wrapper suggestion seems like it would serve my purposes. Thanks!
wez commentedon Aug 10, 2014
I'll close this out as it doesn't require any code change in watchman itself; Thanks!
ci: fix Mac builds broken by llvm@20 pin in #47