Skip to content

Commit fda489a

Browse files
committed
use Python for signal kernel subprocesses
PyPy doesn't create subprocesses in the same way as CPython, resulting in ignored signals when we try to interrupt with `killpg`
1 parent c0f12fb commit fda489a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

jupyter_client/tests/signalkernel.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Distributed under the terms of the Modified BSD License.
44
import os
55
import signal
6+
import sys
67
import time
78
from subprocess import PIPE
89
from subprocess import Popen
@@ -40,7 +41,20 @@ def do_execute(
4041
"user_expressions": {},
4142
}
4243
if code == "start":
43-
child = Popen(["bash", "-i", "-c", "sleep 30"], stderr=PIPE)
44+
child = Popen(
45+
[
46+
sys.executable,
47+
"-c",
48+
'; '.join(
49+
[
50+
"import signal, time",
51+
"signal.signal(signal.SIGINT, signal.SIG_DFL)",
52+
"time.sleep(30)",
53+
]
54+
),
55+
],
56+
stderr=PIPE,
57+
)
4458
self.children.append(child)
4559
reply["user_expressions"]["pid"] = self.children[-1].pid
4660
elif code == "check":

0 commit comments

Comments
 (0)