Skip to content

Commit a367039

Browse files
authored
Don't promote SIGTERM to SIGKILL; let the users do it if needed (#496)
1 parent bd9e262 commit a367039

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

dbos/cli/cli.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -140,26 +140,12 @@ def signal_handler(signum: int, frame: Any) -> None:
140140
Forward kill signals to children.
141141
142142
When we receive a signal, send it to the entire process group of the child.
143-
If that doesn't work, SIGKILL them then exit.
144143
"""
145144
# Send the signal to the child's entire process group
146145
if process.poll() is None:
147146
os.killpg(os.getpgid(process.pid), signum)
148147

149-
# Give some time for the child to terminate
150-
for _ in range(10): # Wait up to 1 second
151-
if process.poll() is not None:
152-
break
153-
time.sleep(0.1)
154-
155-
# If the child is still running, force kill it
156-
if process.poll() is None:
157-
try:
158-
os.killpg(os.getpgid(process.pid), signal.SIGKILL)
159-
except Exception:
160-
pass
161-
162-
# Exit immediately
148+
# Exit
163149
os._exit(process.returncode if process.returncode is not None else 1)
164150

165151
# Configure the single handler only on Unix-like systems.

0 commit comments

Comments
 (0)