Skip to content

Commit

Permalink
Updated basecommand.py such that writing to the log file doesn't fail…
Browse files Browse the repository at this point in the history
…. If

permission is denied for writing in the specified log file the message
will be written to a temporary one.
  • Loading branch information
unknown authored and unknown committed Jun 16, 2012
1 parent c670678 commit 8ebc7a3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pip/basecommand.py
Expand Up @@ -138,8 +138,13 @@ def main(self, args, initial_options):
if store_log:
log_fn = options.log_file
text = '\n'.join(complete_log)
logger.fatal('Storing complete log in %s' % log_fn)
log_fp = open_logfile(log_fn, 'w')
try:
log_fp = open_logfile(log_fn, 'w')
except IOError:
temp = tempfile.NamedTemporaryFile(delete=False)

This comment has been minimized.

Copy link
@garrypolley

garrypolley Sep 5, 2012

Contributor

This causes an error because tempFile is not defined anywhere in this file. Logging an issue now.

log_fn = temp.name
log_fp = open_logfile(log_fn, 'w')
logger.fatal('Storing complete log in %s' % log_fn)
log_fp.write(text)
log_fp.close()
return exit
Expand Down

0 comments on commit 8ebc7a3

Please sign in to comment.