在IEx.pry()之后恢复执行

时间:2018-10-11 13:04:11

标签: elixir

如何在不重新启动会话的情况下退出调试?

respawn命令之后,我丢失了所有先前初始化的变量。

Interactive Elixir (1.7.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> defmodule Test do
...(1)> require IEx
...(1)> def test do
...(1)> s = "Hello"
...(1)> IEx.pry()
...(1)> "#{s}, World!"
...(1)> end
...(1)> end
{:module, Test,
 <<70, 79, 82, 49, 0, 0, 13, 144, 66, 69, 65, 77, 65, 116, 85, 56, 0, 0, 0, 142,
   0, 0, 0, 15, 11, 69, 108, 105, 120, 105, 114, 46, 84, 101, 115, 116, 8, 95,
   95, 105, 110, 102, 111, 95, 95, 7, 99, ...>>, {:test, 0}}
iex(2)> a = 1
1
iex(3)> Test.test
Break reached: Test.test/0 (iex:5)
pry(1)> s
"Hello"
pry(2)> respawn

Interactive Elixir (1.7.3) - press Ctrl+C to exit (type h() ENTER for help)
"Hello, World!"
iex(1)> a
** (CompileError) iex:1: undefined function a/0

1 个答案:

答案 0 :(得分:0)

您不能按照文档https://hexdocs.pm/iex/IEx.Helpers.html#respawn/0中的说明进行操作 它只是开始一个新过程,与上一个过程无关

相关问题