From 442f501696f5909b874bec4921e9fd256b1aa3a1 Mon Sep 17 00:00:00 2001 From: Eric Rasche Date: Sat, 18 Oct 2014 18:38:03 -0400 Subject: [PATCH] lsof translates port names by default This commit ensures we always receive numerical ports from lsof, rather than service names as translated by /etc/services --- config/plugins/visualizations/ipython/templates/ipython.mako | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/plugins/visualizations/ipython/templates/ipython.mako b/config/plugins/visualizations/ipython/templates/ipython.mako index 68a080fb278..f9feaba92b9 100644 --- a/config/plugins/visualizations/ipython/templates/ipython.mako +++ b/config/plugins/visualizations/ipython/templates/ipython.mako @@ -112,7 +112,7 @@ if ':' in HOST: temp_dir = os.path.abspath( tempfile.mkdtemp() ) -############### Getting of port galaxy is being served on. +# Get port galaxy is being served on, if it is being served on a single port via paste process p1 = subprocess.Popen(shlex.split("""ps a"""), stdout=subprocess.PIPE) galaxy_paster_pids = set() @@ -128,7 +128,7 @@ galaxy_paster_pid = galaxy_paster_pids.pop() galaxy_paster_port = None if len(galaxy_paster_pid) > 0: # Find all files opened by the process of interest - p1 = subprocess.Popen(shlex.split("""lsof -p %d""" % (int(galaxy_paster_pid),) ), + p1 = subprocess.Popen(shlex.split("""lsof -P -p %d""" % (int(galaxy_paster_pid),) ), stderr=subprocess.STDOUT, stdout=subprocess.PIPE) # Grep out the TCP connections opened by this process p2 = subprocess.Popen(shlex.split("""grep -o 'TCP [^:]*:[0-9]*'"""), stdin=p1.stdout,