Commit a3fe2903 authored by gab@chromium.org's avatar gab@chromium.org

Ensure files passed to the editor by RunEditor end in a new line

BUG=605201

Review URL: https://codereview.chromium.org/1905693002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@300049 0039d316-1c4b-4281-b951-d872f2087c98
parent 82b04aab
......@@ -1084,7 +1084,11 @@ def RunEditor(content, git, git_editor=None):
'!! Please remove \\r from your change description !!')
fileobj = os.fdopen(file_handle, 'w')
# Still remove \r if present.
fileobj.write(re.sub('\r?\n', '\n', content))
content = re.sub('\r?\n', '\n', content)
# Some editors complain when the file doesn't end in \n.
if not content.endswith('\n'):
content += '\n'
fileobj.write(content)
fileobj.close()
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment