Skip to content

Commit

Permalink
Merge pull request #38 from mmerickel/corrupted-watchman
Browse files Browse the repository at this point in the history
do not crash when receiving corrupted json from watchman
  • Loading branch information
mmerickel authored Oct 5, 2018
2 parents 2265801 + 0b18518 commit 072bd48
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
unreleased
==========

- Ignore corrupted packets coming from watchman that occur in semi-random
scenarios. See https://github.com/Pylons/hupper/pull/38

1.3 (2018-05-21)
================

Expand Down
6 changes: 5 additions & 1 deletion src/hupper/watchman.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ def _recv(self):
line = self._readline()
if not PY2:
line = line.decode('utf8')
return json.loads(line)
try:
return json.loads(line)
except Exception: # pragma: no cover
self.logger.info('ignoring corrupted payload from watchman')
return {}

def _send(self, msg):
cmd = json.dumps(msg)
Expand Down

0 comments on commit 072bd48

Please sign in to comment.