Skip to content

Commit 3970338

Browse files
authored
Merge pull request #2842 from IntersectMBO/fix_port_match
fix: avoid matching a port number that is prefix of other port number
2 parents a5bca3a + 290d4d4 commit 3970338

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cardano_node_tests/cluster_management/netstat_tools.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def kill_old_cluster(instance_num: int) -> None: # noqa: C901
2626
"""Attempt to kill all processes left over from a previous cluster instance."""
2727

2828
def _get_netstat_split() -> list[str]:
29-
return get_netstat_out().splitlines()
29+
return get_netstat_out().replace("\t", " ").splitlines()
3030

3131
def _get_pid(line: str) -> int | None:
3232
try:
@@ -44,7 +44,9 @@ def _try_kill(pid: int) -> None:
4444

4545
port_nums = cluster_nodes.get_cluster_type().cluster_scripts.get_instance_ports(instance_num)
4646
port_strs = [
47-
f":{p}"
47+
# Add whitestpace to the end of each port number to avoid matching a port number that is a
48+
# prefix of another port number.
49+
f":{p} "
4850
for p in (
4951
port_nums.supervisor,
5052
port_nums.webserver,

0 commit comments

Comments
 (0)