##// END OF EJS Templates
mail: use a context manager when writing to mbox...
Matt Harbison -
r47744:d467bae8 default
parent child Browse files
Show More
@@ -208,7 +208,7 b' def _sendmail(ui, sender, recipients, ms'
208
208
209 def _mbox(mbox, sender, recipients, msg):
209 def _mbox(mbox, sender, recipients, msg):
210 '''write mails to mbox'''
210 '''write mails to mbox'''
211 fp = open(mbox, b'ab+')
211 with open(mbox, b'ab+') as fp:
212 # Should be time.asctime(), but Windows prints 2-characters day
212 # Should be time.asctime(), but Windows prints 2-characters day
213 # of month instead of one. Make them print the same thing.
213 # of month instead of one. Make them print the same thing.
214 date = time.strftime('%a %b %d %H:%M:%S %Y', time.localtime())
214 date = time.strftime('%a %b %d %H:%M:%S %Y', time.localtime())
@@ -218,7 +218,6 b' def _mbox(mbox, sender, recipients, msg)'
218 )
218 )
219 fp.write(msg)
219 fp.write(msg)
220 fp.write(b'\n\n')
220 fp.write(b'\n\n')
221 fp.close()
222
221
223
222
224 def connect(ui, mbox=None):
223 def connect(ui, mbox=None):
General Comments 0
You need to be logged in to leave comments. Login now