Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Unified Diff: tools/observatory_tool.py

Issue 1360283002: Silence pub --version tests (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/observatory_tool.py
diff --git a/tools/observatory_tool.py b/tools/observatory_tool.py
index 68fcd86d9f2537b97f3959c7048e05b8baf0c807..5b1c7c58d6f56f6bf24e5f7e5f9673e7dc10f8f0 100755
--- a/tools/observatory_tool.py
+++ b/tools/observatory_tool.py
@@ -41,41 +41,46 @@ def BuildArguments():
return result
def ProcessOptions(options, args):
- # Required options.
- if options.command is None or options.directory is None:
- return False
-
- # Set a default value for pub_snapshot.
- options.pub_snapshot = None
-
- # If we have a working pub executable, try and use that.
- # TODO(whesse): Drop the pub-executable option if it isn't used.
- if options.pub_executable is not None:
- try:
- if 0 == subprocess.call([options.pub_executable, '--version']):
- return True
- except OSError as e:
- pass
- options.pub_executable = None
-
- if options.sdk is not None and utils.CheckedInSdkCheckExecutable():
- # Use the checked in pub executable.
- options.pub_snapshot = os.path.join(utils.CheckedInSdkPath(),
- 'bin',
- 'snapshots',
- 'pub.dart.snapshot');
- try:
- if 0 == subprocess.call([utils.CheckedInSdkExecutable(),
- options.pub_snapshot,
- '--version']):
- return True
- except OSError as e:
- pass
- options.pub_snapshot = None
-
- # We need a dart executable and a package root.
- return (options.package_root is not None and
- options.dart_executable is not None)
+ with open(os.devnull, 'wb') as silent_sink:
+ # Required options.
+ if options.command is None or options.directory is None:
+ return False
+
+ # Set a default value for pub_snapshot.
+ options.pub_snapshot = None
+
+ # If we have a working pub executable, try and use that.
+ # TODO(whesse): Drop the pub-executable option if it isn't used.
+ if options.pub_executable is not None:
+ try:
+ if 0 == subprocess.call([options.pub_executable, '--version'],
+ stdout=silent_sink,
+ stderr=silent_sink):
+ return True
+ except OSError as e:
+ pass
+ options.pub_executable = None
+
+ if options.sdk is not None and utils.CheckedInSdkCheckExecutable():
+ # Use the checked in pub executable.
+ options.pub_snapshot = os.path.join(utils.CheckedInSdkPath(),
+ 'bin',
+ 'snapshots',
+ 'pub.dart.snapshot');
+ try:
+ if 0 == subprocess.call([utils.CheckedInSdkExecutable(),
+ options.pub_snapshot,
+ '--version'],
+ stdout=silent_sink,
+ stderr=silent_sink):
+ return True
+ except OSError as e:
+ pass
+ options.pub_snapshot = None
+
+ # We need a dart executable and a package root.
+ return (options.package_root is not None and
+ options.dart_executable is not None)
Bob Nystrom 2015/09/29 16:06:57 Drive-by! Instead of making an explicit null sink,
def ChangeDirectory(directory):
os.chdir(directory);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698