Skip to content
This repository has been archived by the owner on Nov 13, 2019. It is now read-only.

Commit

Permalink
Added sigpipe usage within a try/except, to handle Windows use cases.…
Browse files Browse the repository at this point in the history
… Sigpipe does not seem to work very consistently, if at all, on Windows. However it is difficult to locate information on it.
  • Loading branch information
joeflack4 committed Feb 26, 2018
1 parent 8c06b75 commit a308a1d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pmix/ppp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
"""
import os
from copy import copy
from signal import signal, SIGPIPE, SIG_DFL
try:
# noinspection PyUnresolvedReferences
from signal import signal, SIGPIPE, SIG_DFL
except ImportError as e:
pass
from itertools import product
from collections import OrderedDict

Expand Down Expand Up @@ -78,7 +82,11 @@ def convert_file(in_file, language=None, outpath=None, **kwargs):
try:
print(output)
except BrokenPipeError: # If output is piped.
signal(SIGPIPE, SIG_DFL)
try:
signal(SIGPIPE, SIG_DFL)
# noinspection PyBroadException
except:
pass
print(output)
except InvalidLanguageException as err:
if str(err):
Expand Down

0 comments on commit a308a1d

Please sign in to comment.