Skip to content

Commit 77463d8

Browse files
Catch OSError in os.tcgetpgrp.
1 parent 2d62bb3 commit 77463d8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pymux/process.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,11 @@ def get_name_for_fd(fd):
426426
"""
427427
Return the process name for a given process ID.
428428
"""
429-
pgrp = os.tcgetpgrp(fd)
429+
try:
430+
pgrp = os.tcgetpgrp(fd)
431+
except OSError:
432+
# See: https://github.com/jonathanslenders/pymux/issues/46
433+
return
430434

431435
try:
432436
with open('/proc/%s/cmdline' % pgrp, 'rb') as f:
@@ -440,7 +444,10 @@ def get_name_for_fd(fd):
440444
"""
441445
Return the process name for a given process ID.
442446
"""
443-
pgrp = os.tcgetpgrp(fd)
447+
try:
448+
pgrp = os.tcgetpgrp(fd)
449+
except OSError:
450+
return
444451

445452
try:
446453
return get_proc_name(pgrp)

0 commit comments

Comments
 (0)