Skip to content

Commit

Permalink
Fix reading from a closed stdin buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
Julius Seporaitis committed Mar 12, 2019
1 parent e5d3812 commit fe18e84
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ available in ``flake8``::
Changes
-------

3.1.1 - 2019-03-12
``````````````````

* Fix reading from stdin when it is closed.

3.1.0 - 2018-02-11
``````````````````
* Add a framework classifier for use in pypi.org
Expand Down
9 changes: 7 additions & 2 deletions flake8_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
import ast
from six import PY2, PY3

__version__ = '3.1.0'
try:
from flake8.engine import pep8 as stdin_utils
except ImportError:
from flake8 import utils as stdin_utils

__version__ = '3.1.1'

PRINT_FUNCTION_NAME = "print"
PPRINT_FUNCTION_NAME = "pprint"
Expand Down Expand Up @@ -78,7 +83,7 @@ def __init__(self, tree, filename):
def load_file(self):
if self.filename in ("stdin", "-", None):
self.filename = "stdin"
self.lines = pycodestyle.stdin_get_value().splitlines(True)
self.lines = stdin_utils.stdin_get_value().splitlines(True)
else:
self.lines = pycodestyle.readlines(self.filename)

Expand Down

0 comments on commit fe18e84

Please sign in to comment.