Pārlūkot izejas kodu

Suppress stderr of the git rev-parse command

In GetPrimarySolutionPath(), redirect the stderr of the
git rev-parse --show-toplevel command to /dev/null. This avoids the
following error message when running depot_tools' ninja command outside
the Chrome source tree:
fatal: not a git repository (or any of the parent directories): .git

I believe this error message was an unintended side effect of the work
on bug 1340825.

Bug: 1340825
Change-Id: I5679a854d1ff23f581564c54c765e13f8ba8b534
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4392154
Commit-Queue: Wan-Teh Chang <wtc@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Wan-Teh Chang 2 gadi atpakaļ
vecāks
revīzija
bc5906f6ff
1 mainītis faili ar 2 papildinājumiem un 2 dzēšanām
  1. 2 2
      gclient_paths.py

+ 2 - 2
gclient_paths.py

@@ -76,8 +76,8 @@ def GetPrimarySolutionPath():
   # checkout that contains a 'buildtools' subdir.
   top_dir = os.getcwd()
   try:
-    top_dir = subprocess2.check_output(
-        ['git', 'rev-parse', '--show-toplevel'])
+    top_dir = subprocess2.check_output(['git', 'rev-parse', '--show-toplevel'],
+                                       stderr=subprocess2.DEVNULL)
     if sys.version_info.major == 3:
       top_dir = top_dir.decode('utf-8', 'replace')
     top_dir = os.path.normpath(top_dir.strip())