File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ defmodule Pythonx.Application do
55
66 @ impl true
77 def start ( _type , _args ) do
8+ enable_sigchld ( )
9+
810 children = [
911 Pythonx.Janitor
1012 ]
@@ -26,4 +28,16 @@ defmodule Pythonx.Application do
2628 else
2729 defp maybe_uv_init ( ) , do: :noop
2830 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+ end
2943end
You can’t perform that action at this time.
0 commit comments