[erlang-questions] Issues with stdin on ports

Per Hedeland per@REDACTED
Wed Jul 31 20:36:45 CEST 2013


Max Lapshin <max.lapshin@REDACTED> wrote:
>
>I have a ffmpeg-like program that is launched by erlang server and it is 
>very busy doing its job.
>
>Sometimes erlang server can decide to kill it.
>
>I have implemented it so: there is a second thread that is reading stdin. 
>If stdin is closed, this thread immediately calls _exit()
>
>Such approach works good but it requires modification of program.

Just in case you (understandably) can't be bothered to read my exchange
with ROK, as of R15B02 you can get hold of the Unix pid of the external
process with erlang:port_info(Port, os_pid), and thus be able to kill it
(using os:cmd/1) without modification of the program. I believe David
Welton posted with a similar issue, i.e. "You can't kill them" - not
true anymore.

--Per



More information about the erlang-questions mailing list