Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix for #1906
  • Loading branch information
ralsina committed Jul 24, 2015
1 parent 2fb49d6 commit 80a49ad
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion nikola/plugins/command/auto/__init__.py
Expand Up @@ -31,6 +31,7 @@
import os
import re
import subprocess
import sys
import time
try:
from urlparse import urlparse
Expand All @@ -43,7 +44,7 @@
from blinker import signal
try:
from ws4py.websocket import WebSocket
from ws4py.server.wsgirefserver import WSGIServer, WebSocketWSGIRequestHandler
from ws4py.server.wsgirefserver import WSGIServer, WebSocketWSGIRequestHandler, WebSocketWSGIHandler
from ws4py.server.wsgiutils import WebSocketWSGIApplication
from ws4py.messaging import TextMessage
except ImportError:
Expand Down Expand Up @@ -406,3 +407,22 @@ def on_any_event(self, event):
"""Call the provided function on any event."""
if event._src_path == self.configuration_filename:
self.function(event)


# Monkeypatch to hide Broken Pipe Errors

f = WebSocketWSGIHandler.finish_response

if sys.version_info[0] == 3:
EX = BrokenPipeError # NOQA
else:
EX = IOError


def finish_response(self):
try:
f(self)
except EX: # On Python3 this is a BrokenPipeException
pass

WebSocketWSGIHandler.finish_response = finish_response

0 comments on commit 80a49ad

Please sign in to comment.