Fix crash on lsof on python3

This commit is contained in:
Florian Mounier
2017-05-15 11:30:59 +02:00
parent 0625e05cbb
commit 269dd2b618
4 changed files with 7 additions and 6 deletions

2
.gitignore vendored
View File

@@ -9,4 +9,4 @@ sass/scss
*.egg-info/
build/
.cache/
.env/
.env*

View File

@@ -4,9 +4,9 @@ include Makefile.config
all: install lint check-outdated run-debug
install:
test -d $(VENV) || virtualenv $(VENV)
$(PIP) install --upgrade --no-cache pip setuptools -e .[lint] devcore
$(NPM) install
test -d $(VENV) || virtualenv $(VENV) -p $(PYTHON_VERSION)
# $(PIP) install --upgrade --no-cache pip setuptools -e .[lint] devcore
# $(NPM) install
clean:
rm -fr $(NODE_MODULES)

View File

@@ -1,7 +1,8 @@
PROJECT_NAME = butterfly
# Python env
VENV = $(PWD)/.env
PYTHON_VERSION ?= python
VENV = $(PWD)/.env$(if $(filter $(PYTHON_VERSION),python),,-$(PYTHON_VERSION))
PIP = $(VENV)/bin/pip
PYTHON = $(VENV)/bin/python
PYTEST = $(VENV)/bin/py.test

View File

@@ -168,7 +168,7 @@ def get_lsof_socket_line(addr, port):
# May want to make this into a dictionary in the future...
regex = "\w+\s+(?P<pid>\d+)\s+(?P<user>\w+).*\s" \
"(?P<laddr>.*?):(?P<lport>\d+)->(?P<raddr>.*?):(?P<rport>\d+)"
output = subprocess.check_output(['lsof', '-Pni'])
output = subprocess.check_output(['lsof', '-Pni']).decode('utf-8')
lines = output.split('\n')
for line in lines:
# Look for local address with peer port