distrobox-enter should terminate child processes when the terminal is closed
- 主要语言
- Go
- 星标
- 13k
- 派生
- 541
- 平均合并
- 20 小时 47 分钟
- 30 天内合并 PR
- 4
描述
A bit of a weird one... I've been trying to figure out why host-spawn, and its children, do not terminate on my machine when I close a terminal window (https://github.com/1player/host-spawn/issues/27). In theory, when you close a terminal window, a SIGHUP is sent to the controlling process, so anything that was running is terminated cleanly, which is what everyone expects.
This doesn't happen with distrobox-enter. This script calls `podman exec`, which ignores SIGHUP (probably because it is/was originally intended to run containers in the background), so any process running inside the container is never terminated and runs indefinitely in the background.
## Steps to reproduce
* Enter a distrobox container in a terminal window
* Run a long running process (`sleep infinity`)
* Close the terminal window
* Notice that the long running process is still running
## Expected behaviour (how it works normally)
* Open a terminal window on the host
* Run a long running process (`sleep infinity`)
* Close the terminal window
* Notice that the long running process has been terminated
This discrepancy is because SIGHUP, sent by the kernel when the pty closes, so that the foreground process can terminate, is being ignored by `podman exec`. I'm unsure what's the best approach here.
贡献指南
调研方向
查看 distrobox-enter 脚本,了解它如何调用 podman exec。调查 podman exec 的信号处理方式,以及如何将 SIGHUP 传播给容器内的进程。使用一个简单的容器和 sleep 命令进行测试,以验证修复。目标是确保终端关闭时子进程终止。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- bash, docker
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 冷清
- 描述清晰度
- 描述清楚
- 新手友好度
- 65/100