Skip to content

Commit

Permalink
improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
soheil committed Dec 7, 2015
1 parent 15d1e25 commit e7a99c2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ssh2
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@ if options.bust_cache or not os.path.exists(cache_file_list) \

child = subprocess.Popen(aws_cmd,
shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if child.stderr.read():
output = child.stdout.read()
error = child.stderr.read()
if error:
print error
print 'Unable to fetch any servers.'
exit()
with open(cache_file_list, 'w') as f:
f.write(child.stdout.read())
f.write(output)

output = open(cache_file_list).read()
parsed = json.loads(output)
Expand Down

0 comments on commit e7a99c2

Please sign in to comment.