blockinfile: Add a newline at EOF when the file is newly created (#3174)

Ref: #2687
pull/18777/head
YAEGASHI Takeshi 8 years ago committed by Matt Clay
parent 9ca2fef23a
commit 8bb9149a10

@ -285,7 +285,7 @@ def main():
if lines: if lines:
result = '\n'.join(lines) result = '\n'.join(lines)
if original and original.endswith('\n'): if original is None or original.endswith('\n'):
result += '\n' result += '\n'
else: else:
result = '' result = ''

Loading…
Cancel
Save