Closed Maxximiliann closed 3 years ago
Using String.split
on the path took care of that issue however:
defmodule PythonStream do
def go() do
python_process_path =
"python3 -u Code%20Drafts/Python/hello_world.py"
|> String.split()
python_process_path
|> Exile.stream!()
end
end
#hello_world.py
while True:
print("Hello World!")
iex(1)> PythonStream.go
%Exile.Stream{
process: #PID<0.656.0>,
stream_opts: %{chunk_size: 65536, exit_timeout: :infinity, input: :no_input}
}
iex(32)>
15:46:35.409 [error] GenServer #PID<0.656.0> terminating
** (ArgumentError) argument error
(exile 0.1.0) Exile.ProcessNif.execute(['/usr/bin/python3', '-u', 'Code%20Drafts/Python/hello_world.py'], ['HOME=/home/maxximiliann', 'WINDOWPATH=2', 'XDG_RUNTIME_DIR=/run/user/1000', 'TERM=xterm-256color', 'VTE_VERSION=6003', 'COLORTERM=truecolor', 'GJS_DEBUG_TOPICS=JS ERROR;JS LOG', 'LANG=en_US.UTF-8', 'XDG_SESSION_CLASS=user', 'DESKTOP_SESSION=ubuntu', 'XDG_CURRENT_DESKTOP=ubuntu:GNOME', 'SSH_AUTH_SOCK=/run/user/1000/keyring/ssh', 'SHLVL=1', 'LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:', 'XMODIFIERS=@im=ibus', 'GDMSESSION=ubuntu', 'MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path', 'PATH=/home/maxximiliann/.asdf/installs/erlang/23.1/erts-11.1/bin:/home/maxximiliann/.asdf/installs/erlang/23.1/bin:/home/maxximiliann/.asdf/plugins/elixir/shims:/home/maxximiliann/.asdf/installs/elixir/1.10.3-otp-22/bin:/home/maxximiliann/.asdf/installs/elixir/1.10.3-otp-22/.mix/escripts:/home/maxximiliann/.asdf/shims:/home/maxximiliann/.asdf/bin:/home/maxximiliann/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin', 'GJS_DEBUG_OUTPUT=stderr', 'LESSCLOSE=/usr/bin/lesspipe %s %s', 'QT_ACCESSIBILITY=1', 'IM_CONFIG_PHASE=1', 'GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/c963629c_9e90_44fe_a92e_f8be9f3dc53e', 'ROOTDIR=/home/maxximiliann/.asdf/installs/erlang/23.1', 'QT_IM_MODULE=ibus', 'GNOME_DESKTOP_SESSION_ID=this-is-deprecated', 'OLDPWD=/home/maxximiliann', 'XDG_SESSION_TYPE=x11', 'GNOME_TERMINAL_SERVICE=:1.159930', 'SHELL=/bin/bash', 'XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg', 'GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1', 'DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus', 'XDG_SESSION_DESKTOP=ubuntu', 'BINDIR=/home/maxximiliann/.asdf/installs/erlang/23.1/erts-11.1/bin', 'SESSION_MANAGER=local/Maxximiliann:@/tmp/.ICE-unix/1837,unix/Maxximiliann:/tmp/.ICE-unix/1837', 'XAUTHORITY=/run/user/1000/gdm/Xauthority', 'PWD=/home/maxximiliann/Desktop/Arbit', 'ASDF_DIR=/home/maxximiliann/.asdf', 'LESSOPEN=| /usr/bin/lesspipe %s', 'PROGNAME=erl', 'USERNAME=maxximiliann', 'MIX_HOME=/home/maxximiliann/.asdf/installs/elixir/1.10.3-otp-22/.mix', 'MANAGERPID=1580', 'XDG_MENU_PREFIX=gnome-', 'EMU=beam', 'GTK_MODULES=gail:atk-bridge', 'LOGNAME=maxximiliann', 'USER=maxximiliann', 'DISPLAY=:0', ...], [], 0)
(exile 0.1.0) lib/exile/process.ex:113: Exile.Process.handle_continue/2
(stdlib 3.13.2) gen_server.erl:680: :gen_server.try_dispatch/4
(stdlib 3.13.2) gen_server.erl:431: :gen_server.loop/7
(stdlib 3.13.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: {:continue, nil}
State: %Exile.Process{args: %{cd: [], cmd_with_args: ['/usr/bin/python3', '-u', 'Code%20Drafts/Python/hello_world.py'], env: ['HOME=/home/maxximiliann', 'WINDOWPATH=2', 'XDG_RUNTIME_DIR=/run/user/1000', 'TERM=xterm-256color', 'VTE_VERSION=6003', 'COLORTERM=truecolor', 'GJS_DEBUG_TOPICS=JS ERROR;JS LOG', 'LANG=en_US.UTF-8', 'XDG_SESSION_CLASS=user', 'DESKTOP_SESSION=ubuntu', 'XDG_CURRENT_DESKTOP=ubuntu:GNOME', 'SSH_AUTH_SOCK=/run/user/1000/keyring/ssh', 'SHLVL=1', 'LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:', 'XMODIFIERS=@im=ibus', 'GDMSESSION=ubuntu', 'MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path', 'PATH=/home/maxximiliann/.asdf/installs/erlang/23.1/erts-11.1/bin:/home/maxximiliann/.asdf/installs/erlang/23.1/bin:/home/maxximiliann/.asdf/plugins/elixir/shims:/home/maxximiliann/.asdf/installs/elixir/1.10.3-otp-22/bin:/home/maxximiliann/.asdf/installs/elixir/1.10.3-otp-22/.mix/escripts:/home/maxximiliann/.asdf/shims:/home/maxximiliann/.asdf/bin:/home/maxximiliann/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin', 'GJS_DEBUG_OUTPUT=stderr', 'LESSCLOSE=/usr/bin/lesspipe %s %s', 'QT_ACCESSIBILITY=1', 'IM_CONFIG_PHASE=1', 'GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/c963629c_9e90_44fe_a92e_f8be9f3dc53e', 'ROOTDIR=/home/maxximiliann/.asdf/installs/erlang/23.1', 'QT_IM_MODULE=ibus', 'GNOME_DESKTOP_SESSION_ID=this-is-deprecated', 'OLDPWD=/home/maxximiliann', 'XDG_SESSION_TYPE=x11', 'GNOME_TERMINAL_SERVICE=:1.159930', 'SHELL=/bin/bash', 'XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg', 'GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1', 'DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus', 'XDG_SESSION_DESKTOP=ubuntu', 'BINDIR=/home/maxximiliann/.asdf/installs/erlang/23.1/erts-11.1/bin', 'SESSION_MANAGER=local/Maxximiliann:@/tmp/.ICE-unix/1837,unix/Maxximiliann:/tmp/.ICE-unix/1837', 'XAUTHORITY=/run/user/1000/gdm/Xauthority', 'PWD=/home/maxximiliann/Desktop/Arbit', 'ASDF_DIR=/home/maxximiliann/.asdf', 'LESSOPEN=| /usr/bin/lesspipe %s', 'PROGNAME=erl', 'USERNAME=maxximiliann', 'MIX_HOME=/home/maxximiliann/.asdf/installs/elixir/1.10.3-otp-22/.mix', 'MANAGERPID=1580', 'XDG_MENU_PREFIX=gnome-', 'EMU=beam', ...], stderr_to_console: 0}, await: %{}, context: nil, errno: nil, pending_read: %Exile.Process.Pending{bin: [], client_pid: nil, remaining: 0}, pending_write: %Exile.Process.Pending{bin: [], client_pid: nil, remaining: 0}, status: :init}
nil
Thanks for reporting. This is sort-of known issue, fix is part of new changes I'm working on. Will try to fix in master this evening.
@Maxximiliann can you check again from the latest master?
defmodule PythonStream do
def go() do
python_process_path =
"python3 -u Code%20Drafts/Python/hello_world.py"
|> String.split()
python_process_path
|> Exile.stream!()
|> Stream.run()
end
end
#hello_world.py
while True:
print("Hello World!")
iex(1)> PythonStream.go
waitpid(): No child processes
** (RuntimeError) command exited with exit_type: :normal, error: :error
(exile 0.1.0) lib/exile/stream.ex:106: anonymous fn/3 in Enumerable.Exile.Stream.reduce/3
(elixir 1.10.3) lib/stream.ex:1415: Stream.do_resource/5
(elixir 1.10.3) lib/stream.ex:649: Stream.run/1
iex(3)> waitpid(): No child processes
10:28:59.700 [debug] Stopping external program
waitpid(): No child processes
waitpid(): No child processes
10:28:59.805 [debug] Failed to stop external program gracefully. attempting SIGTERM
waitpid(): No child processes
waitpid(): No child processes
10:28:59.906 [debug] Failed to stop external program with SIGTERM. attempting SIGKILL
waitpid(): No child processes
10:29:00.908 [error] [exile] failed to kill external process
10:29:00.957 [error] GenServer #PID<0.407.0> terminating
** (RuntimeError) Failed to kill external process
(exile 0.1.0) lib/exile/watcher.ex:63: Exile.Watcher.attempt_graceful_exit/1
(exile 0.1.0) lib/exile/watcher.ex:23: Exile.Watcher.handle_info/2
(stdlib 3.13.2) gen_server.erl:680: :gen_server.try_dispatch/4
(stdlib 3.13.2) gen_server.erl:756: :gen_server.handle_msg/6
(stdlib 3.13.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: {:DOWN, #Reference<0.3438050459.3797155842.247702>, :process, #PID<0.406.0>, :normal}
State: %{context: #Reference<0.3438050459.3797286914.247697>, pid: #PID<0.406.0>, ref: #Reference<0.3438050459.3797155842.247702>}
nil
Are you running OTP-23? Handling of SIG_CHLD signal is changed in OTP-23.
Can you share output of elixir -v
$ elixir -v Erlang/OTP 23 [erts-11.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]
Elixir 1.10.3 (compiled with Erlang/OTP 22)
How do we resolve this error?