<div dir="auto"><div>Hi,</div><div dir="auto"><br></div><div dir="auto">Ah ok that should solve it! I read from a Bluetooth socket and wrote to stdout using blocking io and wasn't reading from stdin at all... That's why I got confused about how Erlang killed the process. Changed to using poll and check for POLLHUP on stdin.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra" dir="auto"><br></div><div class="gmail_extra" dir="auto">Thanks,</div><div class="gmail_extra" dir="auto">Albin</div><div class="gmail_extra" dir="auto"><br><div class="gmail_quote" dir="auto">On Jul 16, 2017 19:40, "Ali Sabil" <<a href="mailto:ali.sabil@gmail.com">ali.sabil@gmail.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Albin,<div><br></div><div>The Erlang runtime doesn't actually kill the port, but just closes the pipe. You port should then detect an end-of-file on its input pipe.</div><div><br></div><div>Best,</div><div>Ali</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div class="elided-text">On Sun, Jul 16, 2017 at 6:28 PM, Albin Stigö <span dir="ltr"><<a href="mailto:albin.stigo@gmail.com" target="_blank">albin.stigo@gmail.com</a>></span> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="elided-text">Hello,<br>
<br>
I have a program that relies on C API calls to the Linux bluetooth<br>
stack (bluez) so I wrote a port program for that...<br>
<br>
There seems to be a bug in the version of the bluez stack I'm using<br>
that requires programs to clean up after themselves or the program<br>
will fail on the next execution (I guess some garbage state in driver<br>
/ hardware).<br>
<br>
I have tried to catch SIGPIPE/SIGTERM and check for EPIPE in my port<br>
but it doesn't seem to work. How does Erlang kill ports? SIGKILL?<br>
<br>
Any ideas on how to clean up on exit..? I realise this is very fragile<br>
but as of now I need to work around this bug...<br>
<br>
<br>
--Albin<br></div>
______________________________<wbr>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/list<wbr>info/erlang-questions</a><br>
</blockquote></div><br></div>
</blockquote></div><br></div></div></div>