| Index: tools/observatory_tool.py
|
| diff --git a/tools/observatory_tool.py b/tools/observatory_tool.py
|
| index adf103fde62b31c32ee4ab930f40256ae9c9de62..ffc76df24ab34fc72c46c26c5c967e3b8d411d07 100755
|
| --- a/tools/observatory_tool.py
|
| +++ b/tools/observatory_tool.py
|
| @@ -43,14 +43,20 @@ def ProcessOptions(options, args):
|
| # Required options.
|
| if (options.command == None) or (options.directory == None):
|
| return False
|
| - # If we have a pub executable, we are running from the dart-sdk.
|
| - if (options.pub_executable != None):
|
| - return True
|
| if (options.sdk != None):
|
| # Use the checked in pub executable by default.
|
| options.pub_executable = utils.CheckedInPubPath()
|
| - return True
|
| - # Otherwise, we need a dart executable and a package root.
|
| + # If we have a working pub executable, we are running from the dart-sdk.
|
| + if (options.pub_executable != None):
|
| + try:
|
| + if utils.CheckedInSdkFixExecutable() and 0 == subprocess.call(
|
| + [options.pub_executable, '--version']):
|
| + return True
|
| + except OSError as e:
|
| + pass
|
| + # The pub executable didn't work, use the backup procedure.
|
| + options.pub_executable = None
|
| + # We need a dart executable and a package root.
|
| return ((options.package_root != None) and
|
| (options.dart_executable != None))
|
|
|
| @@ -158,4 +164,4 @@ def main():
|
| return ExecuteCommand(options, args)
|
|
|
| if __name__ == '__main__':
|
| - sys.exit(main());
|
| + sys.exit(main());
|
|
|