Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IEX.pry from another node #3392

Closed
kdisneur opened this issue Jun 11, 2015 · 8 comments
Closed

IEX.pry from another node #3392

kdisneur opened this issue Jun 11, 2015 · 8 comments

Comments

@kdisneur
Copy link

@kdisneur kdisneur commented Jun 11, 2015

When you want to debug a Phoenix application for example, the application process must run in the same iex process (i.e: iex -S mix phoenix.start).

It could be awesome if we could pry from another iex node.

@josevalim
Copy link
Member

@josevalim josevalim commented Jun 11, 2015

@kdisneur I am travelling today and I just tried some sample implementation out. My first approach was that IEx.pry would automatically find another node, giving preference to local implementation.

However, we can only find nodes that have been connected upfront, so your code sample would only work if you called Node.connect :foo from node :bar or vice-versa, which kinda defeats the purpose.

The only other option I can think is to pass the node name directly as argument, something like: IEx.pry(:name_of_the_other_node). Thoughts?

@kdisneur
Copy link
Author

@kdisneur kdisneur commented Jun 11, 2015

However, we can only find nodes that have been connected upfront, so your code sample would only work if you called Node.connect :foo from node :bar or vice-versa, which kinda defeats the purpose.

Yup it makes sense and, anyway, trying to automatically find an IEX node would maybe be too much magic?

The only other option I can think is to pass the node name directly as argument, something like: IEx.pry(:name_of_the_other_node). Thoughts?

Just to be sure to understand it well, your proposition is:

  • in your main app: just put IEx.pry(:name_of_the_other_node)
  • on another shell: start iex --sname name_of_the_other_node
  • profit \o/

This option looks pretty simple (in a user point of view) because it's easy to start an IEX with a specific name.

Maybe could be worth to ask @jtrim is thought (it's the author of the blog post talking about this feature)

@fishcakez
Copy link
Member

@fishcakez fishcakez commented Jun 11, 2015

Have you tried using --remsh to start an IEx session on the target node from another node?

@fishcakez
Copy link
Member

@fishcakez fishcakez commented Jun 11, 2015

Oh I just tested and it doesn't work :(

@fishcakez
Copy link
Member

@fishcakez fishcakez commented Jun 11, 2015

Just to clarify my comments, I was a little brief. I think we should support:

elixir --name "foo@host" -S mix run

and

iex --name "bar@host" --remsh "foo@host"

Where IEx.pry/0 is called from an application on foo@host. The fact this doesn't work is a bug. I think this is preferable to adding the node name because the node does not need to be known in advance.

@josevalim
Copy link
Member

@josevalim josevalim commented Jun 16, 2015

Added with 4af9b7e.

@josevalim josevalim closed this Jun 16, 2015
@kdisneur
Copy link
Author

@kdisneur kdisneur commented Jun 16, 2015

Thanks @josevalim

@jtrim
Copy link

@jtrim jtrim commented Jun 18, 2015

Wow, I should pay more attention to Twitter. Great work @josevalim @fishcakez @kdisneur - such a pleasant surprise to find one of my blog posts spurred development on a core IEx feature! Thanks for implementing! 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants