1
0
mirror of https://github.com/facebook/proxygen.git synced 2025-08-08 18:02:05 +03:00

Forced watchman daemon to always operate in non elevated mode on Windows (#878)

Summary:
Recently I found that its impossible to access elevated Watchman daemon from non-elevated process on Windows.

```
events.js:174
      throw er; // Unhandled 'error' event
      ^
Error: connect EPERM \\.\pipe\watchman
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1106:14)
Emitted 'error' event at:
    at Socket.<anonymous> (C:\open\ovrsource\unity\socialvr\_js\node_modules\fb-watchman\index.js:118:12)
    at Socket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
```

To fix this, it was suggested by wez to use [his library](https://github.com/wez/EleDo) to force Watchman daemon always start in normal mode on Windows. In this stack of commits I did integrated his library into project and used it to force daemon restart in normal mode when spawned from elevated terminal.

To make it happen, I checked-in library sources and created proxy project which depends on the initial library and contains header bindings and cmake configuration. I did copy pasted Rust cmake macroses from another facebook project - eden, and also created analogue of autogen.sh but for Windows - autogen.cmd.

Pull Request resolved: https://github.com/facebook/watchman/pull/878

Test Plan:
Launch elevated terminal
Start watchman.exe produced from sources
Observe daemon starting and answering
In process monitor, observe watchman.exe process running under user group

Reviewed By: fanzeyi

Differential Revision: D25595879

Pulled By: arhelmus

fbshipit-source-id: 15eb29adcf5bd4a5708b6533a1b2bacbf13f431c
This commit is contained in:
Arthur Kushka
2020-12-21 15:15:52 -08:00
committed by Facebook GitHub Bot
parent 89a9ef90ce
commit 046a69f909
3 changed files with 296 additions and 0 deletions

View File

@@ -114,6 +114,10 @@ class ProjectCmdBase(SubCmd):
elif len(parts) == 1:
project = args.project
path = parts[0]
# On Windows path contains colon, e.g. C:\open
elif os.name == "nt" and len(parts) == 3:
project = parts[0]
path = parts[1] + ":" + parts[2]
else:
raise UsageError(
"invalid %s argument; too many ':' characters: %s" % (arg_type, arg)