<div dir="ltr">Thanks! <div style>Will try out both approaches (stty/sighandler) and evaluate which one is closer to what we need.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Mar 23, 2013 at 1:12 AM, Andrew Tunnell-Jones <span dir="ltr"><<a href="mailto:andrewtj@gmail.com" target="_blank">andrewtj@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<div><br></div><div>I wrote a signal handler a little while back. With it you can do something like:</div><div><br></div>
<div> {ok,Ref} = sighandler:install(int,fun() -> io:fwrite("Interrupt disabled\n") end).</div><div><br></div><div>And if you later want to restore interrupt:</div><div><br></div><div> sighandler:remove(Ref).</div>
<div><br></div><div>Be aware:</div><div> * It uses a driver</div><div> * I've not (yet) updated it to suit the change in the driver API in R16 from driver_output_term() to erl_drv_output_term() (it still works in R16, but won't in R17)</div>
<div> * I've not used it in any serious way (and have no immediate plans to)<br></div><div><br></div><div>The code is available from <<a href="https://github.com/andrewtj/sighandler" target="_blank">https://github.com/andrewtj/sighandler</a>>.</div>
<div><br></div><div>Regards,</div><div>Andrew</div><div class="HOEnZb"><div class="h5"><div><br>On Tuesday, March 19, 2013 10:09:52 AM UTC+11, Michał Ptaszek wrote:<blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hey, <div><br></div><div>in order to avoid stupid mistakes on production we have disabled break signal handling for the VM by adding +Bi switch to the options passed to 'beam.smp' command. As a result, if anyone is connect to the shell via pipe and hits CTRL+C - nothing should happen. In order to kill the node someone must intentionally run init:stop()/q() from inside of the node.</div>
<div><br></div><div>Unfortunately, as a result, we are not able to handle USR1 signals anymore and thus not being able to generate crash dumps when the VM is stuck. If +Bi option is passed VM is terminated with "User defined signal 1" reason. </div>
<div><br></div><div>Temporarily we can run the VM with +Bc switch however I was wondering if there is any other way to completely disable SIGINT, but not SIGUSR1 signal handlers?</div><div><br></div><div>
Thanks, </div><div>Michal </div></div>
</blockquote></div></div></div></blockquote></div><br></div>