Skip to content

Commit 6d41640

Browse files
authored
Send signal even if process is gone (#162)
* Send signal even if process is gone * hmm * hmm
1 parent 744cead commit 6d41640

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/python/tests.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@ def pgcat_start():
1818

1919

2020
def pg_cat_send_signal(signal: signal.Signals):
21-
for proc in psutil.process_iter(["pid", "name"]):
22-
if "pgcat" == proc.name():
23-
os.kill(proc.pid, signal)
21+
try:
22+
for proc in psutil.process_iter(["pid", "name"]):
23+
if "pgcat" == proc.name():
24+
os.kill(proc.pid, signal)
25+
except Exception as e:
26+
# The process can be gone when we send this signal
27+
print(e)
28+
2429
if signal == signal.SIGTERM:
2530
# Returns 0 if pgcat process exists
2631
time.sleep(2)

0 commit comments

Comments
 (0)