switch gcloud command to IO.popen from backticks (#194)

This commit is contained in:
Graham Paye 2019-02-21 14:38:34 -08:00 committed by GitHub
parent e6a8fed091
commit d765472f35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -174,7 +174,8 @@ module Google
def load_gcloud_project_id
gcloud = GCLOUD_WINDOWS_COMMAND if OS.windows?
gcloud = GCLOUD_POSIX_COMMAND unless OS.windows?
config = MultiJson.load(`#{gcloud} #{GCLOUD_CONFIG_COMMAND}`)
gcloud_json = IO.popen("#{gcloud} #{GCLOUD_CONFIG_COMMAND}", &:read)
config = MultiJson.load gcloud_json
config['configuration']['properties']['core']['project']
rescue
nil