iex --remsh halts the remote node at end of input
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 75/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- erlang
- 领域
- cli
调研方向
shell 在 lib/elixir/src/iex.erl 中启动:get_remsh 分支选择 MFA,start_mfa/2 为本地和远程 shell 都设置了 {on_eof, halt}。在 target 节点运行时,使用 printf '1\n' | iex --sname client --remsh target@host 复现,并确认 target 会退出。修复应只为远程分支传入不会停止的 on_eof,使远程节点继续运行,本地客户端以状态码 0 退出。请检查本地 iex 在输入结束时仍会停止。
由索引模型根据 Issue 内容生成。
描述
Elixir and Erlang/OTP versions
Elixir 1.20.1, 1.20.4 and main (b77fe287), on Erlang/OTP 28.5.0.2 and 29.1.1.
Operating system
NixOS (Linux)
Current behavior
iex --remsh halts the remote node when the local shell's input ends. In a terminal without line editing (TERM unset, dumb, or a TERM the host's terminfo lacks, for example xterm-kitty on a stock server), Ctrl+D on an empty line ends the input. The same happens when stdin is a pipe.
$ iex --sname target --cookie c
$ TERM=dumb iex --sname client --cookie c --remsh target@$(hostname -s)
iex(target@host)1> ^D
The target node exits with status 0. printf '1\n' | iex --sname client --cookie c --remsh target@host halts it the same way.
iex.erl passes {on_eof, halt} to IEx.Server for both local and remote shells (lib/elixir/src/iex.erl:78), and IEx.Server runs System.halt(0) on the remote node. With line editing, Ctrl+D only deletes forward, so the bug depends on the terminal. erl -remsh does not halt the remote node in the same setups.
Expected behavior
End of input in a remote shell ends the shell and leaves the remote node running, like erl -remsh. Halting on end of input makes sense for a local iex, where the shell owns the node.
A three-line change does it, passing stop_evaluator (IEx.Server's default) in the --remsh branch:
--- a/lib/elixir/src/iex.erl
+++ b/lib/elixir/src/iex.erl
@@ -53,7 +53,7 @@
case get_remsh(Args) of
nil ->
- start_mfa(Args, {elixir, start_cli, []});
+ start_mfa(Args, {elixir, start_cli, []}, halt);
@@ -67,15 +67,15 @@
- {remote, Remote, start_mfa(Args, {?MODULE, sync_remote, [Parent, Ref]})}
+ {remote, Remote, start_mfa(Args, {?MODULE, sync_remote, [Parent, Ref]}, stop_evaluator)}
end.
@@
-start_mfa(Args, MFA) ->
- Opts = [{dot_iex, get_dot_iex(Args)}, {on_eof, halt}],
+start_mfa(Args, MFA, OnEof) ->
+ Opts = [{dot_iex, get_dot_iex(Args)}, {on_eof, OnEof}],
{?MODULE, start, [Opts, MFA]}.
With it, Ctrl+D and piped input end the client with status 0 and the remote node keeps running. Happy to open a PR.
- 主要语言
- Elixir
- 星标
- 26.7k
- 派生
- 3.7k
- 平均合并
- 8 小时 8 分钟
- 30 天内合并 PR
- 61
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
elixir-lang/elixir 的其他 Issue
-
map_(get|put|update) ignore atom fields with static term() key可能已有人在做 @lukaszsamson 于 23 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 45/100
elixir-lang/elixir#15932 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 55/100
elixir-lang/elixir#15909 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 64/100
elixir-lang/elixir#15900 ·
维护者通常 1 天内回复
-
Gradual map domain with `none` looses static part when computing lower bound可能已有人在做 @lukaszsamson 于 41 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 48/100
elixir-lang/elixir#15854 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 56/100
elixir-lang/elixir#15837 ·
维护者通常 1 天内回复
查看 elixir-lang/elixir 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 2 天内回复
-
ci-cd
难度 2/5 1-3 小时 新手友好度 72/100
carverauto/serviceradar#5648 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
opentelemetry_bandit: handler is detached when a client disconnects before the request starts (get_peer_data raises :enotconn)可能已有人在做 @yordis 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
open-telemetry/opentelemetry-erlang-contrib#846 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100