What is the recommended way to gracefully stop a Haskell process?

未关闭
#119 4 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
20/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
haskell

调研方向

从 terminateProcess 和已记录的 SIGTERM 行为开始;将其与 issue 和链接的测试 gist 中描述的 SIGINT 路径进行比较。检查 Unix 和 Windows 上的影响,然后确定跨平台的优雅停止 API 是否应属于 process,以及在提出更改之前应涵盖哪些清理行为。

由索引模型根据 Issue 内容生成。

描述

The only function to stop a process I found is terminateProcess.
According to the documentation, on Unix systems it will send the SIGTERM signal.
I did some research and concluded that apparently when a Haskell process receives SIGTERM signal, it will not throw an exception to the main thread, but will stop everything rudely, so that, for example, second action passed to bracket will not be executed. That differs from SIGINT handling which causes UserInterrupt to be thrown. I used this code to test it.
But I want to kill a process gracefully, to allow bracket to do all cleanup actions.

So I am wondering: shouldn't process have a function which will do it?
Alternatively I can use System.Posix.Signals from unix to send SIGINT directly (and do something else on Windows). Or I can set a special handler for SIGTERM in my Haskell program which will behave akin to SIGINT.
I would appreciate any recommendations.

主要语言
Haskell
星标
91
派生
93
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

haskell/process 的其他 Issue

查看 haskell/process 的全部 Issue

相似的 Issue

更多 Haskell Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。