Bug 1395079 - Query version of watchman without using daemon; r=mshal
authorGregory Szorc <gps@mozilla.com>
Wed, 30 Aug 2017 10:02:36 -0700
changeset 378021 2e2062e0bc3691e9a85b0925a9055d0d51ca5935
parent 378020 eab0db5216b78b958d71d26d92d1f32adbdaec9c
child 378022 0a8f8b47a1fe7a838aeecb9bed11b8ea09a4764a
push id32421
push userarchaeopteryx@coole-files.de
push dateFri, 01 Sep 2017 08:31:26 +0000
treeherdermozilla-central@583e73fb8e3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal
bugs1395079
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1395079 - Query version of watchman without using daemon; r=mshal See inline comment for why. We may want a follow-up configure check for whether watchman is usable (whether we can communicate with the daemon). This can be deferred to another bug. MozReview-Commit-ID: IHfyn7v7vm8
moz.configure
--- a/moz.configure
+++ b/moz.configure
@@ -366,36 +366,32 @@ def tup_progs(build_backends):
 tup = check_prog('TUP', tup_progs)
 
 # watchman detection
 # ==============================================================
 
 option(env='WATCHMAN', nargs=1, help='Path to the watchman program')
 
 @depends('WATCHMAN')
-@imports('json')
 def watchman_info(prog):
     if not prog:
         prog = find_program('watchman')
 
     if not prog:
         return
 
-    out = check_cmd_output(prog, 'version', onerror=lambda: None)
+    # `watchman version` will talk to the Watchman daemon service.
+    # This can hang due to permissions problems. e.g.
+    # https://github.com/facebook/watchman/issues/376. So use
+    # `watchman --version` to prevent a class of failures.
+    out = check_cmd_output(prog, '--version', onerror=lambda: None)
     if out is None:
         return
 
-    # Assume a process not emitting JSON is not watchman or is a
-    # broken watchman.
-    try:
-        res = json.loads(out)
-    except ValueError:
-        return
-
-    return namespace(path=prog, version=Version(res['version']))
+    return namespace(path=prog, version=Version(out.strip()))
 
 @depends_if(watchman_info)
 @checking('for watchman')
 def watchman(w):
     return w.path
 
 @depends_if(watchman_info)
 @checking('for watchman version')