Skip to content

Commit

Permalink
avocado/utils/process.py: fix duplicate int conversion
Browse files Browse the repository at this point in the history
Commit 3362a30 erronously added a second identical conversion of
the signal and process ID integers to the formatting string.

This removes the duplication.

Signed-off-by: Cleber Rosa <[email protected]>
  • Loading branch information
clebergnu committed Jul 27, 2023
1 parent db25224 commit e2f70c6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions avocado/utils/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def safe_kill(pid, signal): # pylint: disable=W0621
:param signal: Signal number.
"""
if get_owner_id(int(pid)) == 0:
kill_cmd = f"kill -{int(int(signal))} {int(int(pid))}"
kill_cmd = f"kill -{int(signal)} {int(pid)}"
try:
run(kill_cmd, sudo=True)
return True
Expand Down Expand Up @@ -304,7 +304,7 @@ def process_in_ptree_is_defunct(ppid):
except CmdError: # Process doesn't exist
return True
for pid in pids:
cmd = f"ps --no-headers -o cmd {int(int(pid))}"
cmd = f"ps --no-headers -o cmd {int(pid)}"
proc_name = system_output(cmd, ignore_status=True, verbose=False)
if "<defunct>" in proc_name:
defunct = True
Expand Down Expand Up @@ -795,7 +795,7 @@ def send_signal(self, sig):
pids = get_children_pids(self.get_pid())
pids.append(self.get_pid())
for pid in pids:
kill_cmd = f"kill -{int(int(sig))} {int(pid)}"
kill_cmd = f"kill -{int(sig)} {int(pid)}"
with contextlib.suppress(Exception):
run(kill_cmd, sudo=True)
else:
Expand Down

0 comments on commit e2f70c6

Please sign in to comment.