Skip to content

Commit

Permalink
fix invalid exit code (for #455)
Browse files Browse the repository at this point in the history
This problem occurs when the in-place option and the exit-code option
are specified and the result of modifying W391 is only blank lines.
  • Loading branch information
hhatto committed Dec 14, 2018
1 parent 610de71 commit 40bcf6f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions autopep8.py
Expand Up @@ -3436,7 +3436,7 @@ def fix_file(filename, options=None, output=None, apply_config=False):
with open_with_encoding(filename, 'w', encoding=encoding) as fp:
fp.write(fixed_source)
return fixed_source
return ''
return None
else:
if output:
output.write(fixed_source)
Expand Down Expand Up @@ -4060,9 +4060,11 @@ def fix_multiple_files(filenames, options, output=None):
ret = _fix_file((name, options, output))
if ret is None:
continue
if options.diff or options.in_place:
if options.diff:
if ret != '':
results.append(ret)
elif options.in_place:
results.append(ret)
else:
original_source = readlines_from_file(name)
if "".join(original_source).splitlines() != ret.splitlines():
Expand Down

0 comments on commit 40bcf6f

Please sign in to comment.