はじめてなElixir(12)いろんな方法で並行プロセスを作る(失敗編) が、やったこととうまくいっていないところも書いてくれているので手助けしやすい気がする。応援の気持ちをこめ、やりたいことができるように書いてみます。 プロセスの終了を捕まえる spawn_link でプロセスの終了を捕まえるで、何の反応もなくプロセスが終了しているように見えてしまいます。実はメッセージにプロセス終了のお知らせがきているのでした。 Process.flag(:trap_exit, true) を宣言したプロセスは、そのプロセスから spawn_link した先のプロセスが異常終了したときに メッセージ を受けとります。ですから receive do mes の mes を表示してみると内容が表示されているはずです。 メッセージの中身を表示するようにした差分です $ diff -w link10.orig.