Bug 1293534: Fix .ycm_extra_conf after bug 1195748. r=gps
authorEmilio Cobos Álvarez <ecoal95@gmail.com>
Mon, 08 Aug 2016 21:00:20 -0700
changeset 308838 578ebd592745ff2b7647b205576f20b5b36f3327
parent 308837 9beaa75894056714aefe9737fbafc19afa3e8df7
child 308839 9999b6b8022bfe815d79a4f309986d2859285e16
push id30550
push usercbook@mozilla.com
push dateWed, 10 Aug 2016 13:55:02 +0000
treeherdermozilla-central@c12bb83ad278 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1293534, 1195748
milestone51.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 1293534: Fix .ycm_extra_conf after bug 1195748. r=gps MozReview-Commit-ID: HwNnOUThxev
.ycm_extra_conf.py
--- a/.ycm_extra_conf.py
+++ b/.ycm_extra_conf.py
@@ -22,16 +22,20 @@ if not os.path.exists(path):
     path = os.path.join(config.topsrcdir, 'mach')
 mach_module = imp.load_module('_mach', open(path), path, ('', 'r', imp.PY_SOURCE))
 
 sys.dont_write_bytecode = old_bytecode
 
 def FlagsForFile(filename):
     mach = mach_module.get_mach()
     out = StringIO()
+
+    # Mach calls sys.stdout.fileno(), so we need to fake it when capturing it.
+    # Returning an invalid file descriptor does the trick.
+    out.fileno = lambda: -1
     out.encoding = None
     mach.run(['compileflags', filename], stdout=out, stderr=out)
 
     flag_list = shlex.split(out.getvalue())
 
     # This flag is added by Fennec for android build and causes ycmd to fail to parse the file.
     # Removing this flag is a workaround until ycmd starts to handle this flag properly.
     # https://github.com/Valloric/YouCompleteMe/issues/1490