diff --git a/test/functional/test_framework/netutil.py b/test/functional/test_framework/netutil.py index f6acf926fa8c1..b4570a9d79ea7 100644 --- a/test/functional/test_framework/netutil.py +++ b/test/functional/test_framework/netutil.py @@ -37,9 +37,12 @@ def get_socket_inodes(pid): base = '/proc/%i/fd' % pid inodes = [] for item in os.listdir(base): - target = os.readlink(os.path.join(base, item)) - if target.startswith('socket:'): - inodes.append(int(target[8:-1])) + try: + target = os.readlink(os.path.join(base, item)) + if target.startswith('socket:'): + inodes.append(int(target[8:-1])) + except FileNotFoundError: + pass return inodes def _remove_empty(array):