2828 % % we can't handle SIGCONT, the signal used to resume the
2929 % % program. Unfortunately, it makes a SIGTSTP handler less
3030 % % useful here.
31- sigtstp => ignore
31+ sigtstp => ignore ,
32+
33+ % % SIGINFO is triggered on *BSD systems by Ctrl+T to query the status
34+ % % of the program. Things like the progress of a task.
35+ siginfo => ignore ,
36+
37+ % % SIGWINCH is triggered when the terminal window size changes to
38+ % % allow the prograp to redraw its output.
39+ sigwinch => ignore
3240 }).
3341
3442-define (SIGNAL_HANDLED_BY_ERLANG (Signal ),
@@ -55,13 +63,13 @@ setup() ->
5563 end .
5664
5765init (_Args ) ->
58- maps :fold (
66+ maps :foreach (
5967 fun
60- (Signal , _ , Ret ) when ? SIGNAL_HANDLED_BY_ERLANG (Signal ) -> Ret ;
61- (Signal , default , ok ) -> os :set_signal (Signal , default );
62- (Signal , ignore , ok ) -> os :set_signal (Signal , ignore );
63- (Signal , _ , ok ) -> os :set_signal (Signal , handle )
64- end , ok , ? SIGNALS_HANDLED_BY_US ),
68+ (Signal , _ ) when ? SIGNAL_HANDLED_BY_ERLANG (Signal ) -> ok ;
69+ (Signal , default ) -> catch os :set_signal (Signal , default );
70+ (Signal , ignore ) -> catch os :set_signal (Signal , ignore );
71+ (Signal , _ ) -> catch os :set_signal (Signal , handle )
72+ end , ? SIGNALS_HANDLED_BY_US ),
6573 {ok , #{}}.
6674
6775handle_event (Signal , State ) when ? SIGNAL_HANDLED_BY_ERLANG (Signal ) ->
0 commit comments