We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 52a9a85 commit ea29718Copy full SHA for ea29718
1 file changed
lib/pythonx/application.ex
@@ -5,6 +5,8 @@ defmodule Pythonx.Application do
5
6
@impl true
7
def start(_type, _args) do
8
+ enable_sigchld()
9
+
10
children = [
11
Pythonx.Janitor
12
]
@@ -26,4 +28,16 @@ defmodule Pythonx.Application do
26
28
else
27
29
defp maybe_uv_init(), do: :noop
30
end
31
32
+ defp enable_sigchld() do
33
+ # Some APIs in Python, such as subprocess.run, wait for a child
34
+ # OS process to finish. On Unix, this relies on `waitpid` C API,
35
+ # which does not work properly if SIGCHLD is ignored, resulting
36
+ # in infinite waiting. ERTS ignores the signal by default, so we
37
+ # explicitly restore the default handler.
38
+ case :os.type() do
39
+ {:win32, _osname} -> :ok
40
+ {:unix, _osname} -> :os.set_signal(:sigchld, :default)
41
+ end
42
43
0 commit comments