Skip to content

Commit

Permalink
Nit: add type information
Browse files Browse the repository at this point in the history
  • Loading branch information
kaste committed Sep 23, 2024
1 parent f00a753 commit c47e340
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def line_indentation(line):
return len(line) - len(line.lstrip())


def kill_proc(proc):
def kill_proc(proc: subprocess.Popen) -> None:
if sys.platform == "win32":
# terminate would not kill process opened by the shell cmd.exe,
# it will only kill cmd.exe leaving the child running
Expand All @@ -375,16 +375,16 @@ def kill_proc(proc):
proc.terminate()


def try_kill_proc(proc):
def try_kill_proc(proc: Optional[subprocess.Popen]) -> None:
if proc:
try:
kill_proc(proc)
except ProcessLookupError:
pass
proc.got_killed = True
proc.got_killed = True # type: ignore[attr-defined]


def proc_has_been_killed(proc):
def proc_has_been_killed(proc: subprocess.Popen) -> bool:
return getattr(proc, "got_killed", False)


Expand Down

0 comments on commit c47e340

Please sign in to comment.