How can I print a PID in Elixir?

RubenLaguna

I tried to:

pid = spawn fn -> 1 + 2 end
IO.puts(pid)
IO.puts(IO.inspect(pid))

and both given a

** (Protocol.UndefinedError) protocol String.Chars not implemented for #PID<0.59.0>

There must be a way to get the "#PID<0.59.0>" representation of the pid, since the REPL prints that #PID<0.59.0>.

CoderDennis

You don't need to wrap IO.inspect in a call to IO.puts. Simply calling IO.inspect will do what you're looking for.

pid = spawn fn -> 1 + 2 end
IO.inspect(pid)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I print this?

From Dev

How can I run systemd as a process with pid 1 and with pid not 1?

From Dev

How can I get the pid of a subshell?

From Dev

How can I exit quietly from Elixir?

From Dev

How can I generate a sequence of numbers in Elixir?

From Dev

How can I print a Maybe?

From Dev

How can I print 413284921265094656?

From Dev

How can I print 413284921265094656?

From Dev

Cygwin: How can I obtain the PID of a program started by CygStart?

From Dev

How can I find out which PID belongs to which script?

From Dev

How can I get the ProcessID (PID) for a hidden Excel Application instance

From Dev

How can I get the cpu% usage of a Windows Pid on the command line?

From Dev

How can I get the ProcessID (PID) for a hidden Excel Application instance

From Dev

How can I use Monit to monitor a service that does not have a /var/run/ pid file or how can I create a pid file?

From Dev

How can I get pid and its executable path information through the file which is executed by this pid?

From Dev

How can I get pid and its executable path information through the file which is executed by this pid?

From Dev

Elixir - How can I unquote an array of functions in my macro?

From Dev

How can I get the current operating system name in Elixir?

From Dev

How can I know amount of cores in the CPU for elixir?

From Dev

How can I handle the empty case in Elixir/Phoenix templates?

From Dev

How can I do a line break (line continuation) in Elixir?

From Dev

Elixir: How can I describe mix.exs settings correctly?

From Dev

How can I load a module into another module using Elixir language?

From Dev

How can I add LiveView to an existing Elixir/Phoenix app?

From Dev

How can I combine css and less using Elixir?

From Dev

How can I calculate sum of query results in Elixir?

From Dev

How can I profile my elixir phoenix server?

From Dev

Replacing sidekiq jobs with Elixir: how can I learn about concurrency?

From Dev

How can I print the lowest key of an array?

Related Related

  1. 1

    How can I print this?

  2. 2

    How can I run systemd as a process with pid 1 and with pid not 1?

  3. 3

    How can I get the pid of a subshell?

  4. 4

    How can I exit quietly from Elixir?

  5. 5

    How can I generate a sequence of numbers in Elixir?

  6. 6

    How can I print a Maybe?

  7. 7

    How can I print 413284921265094656?

  8. 8

    How can I print 413284921265094656?

  9. 9

    Cygwin: How can I obtain the PID of a program started by CygStart?

  10. 10

    How can I find out which PID belongs to which script?

  11. 11

    How can I get the ProcessID (PID) for a hidden Excel Application instance

  12. 12

    How can I get the cpu% usage of a Windows Pid on the command line?

  13. 13

    How can I get the ProcessID (PID) for a hidden Excel Application instance

  14. 14

    How can I use Monit to monitor a service that does not have a /var/run/ pid file or how can I create a pid file?

  15. 15

    How can I get pid and its executable path information through the file which is executed by this pid?

  16. 16

    How can I get pid and its executable path information through the file which is executed by this pid?

  17. 17

    Elixir - How can I unquote an array of functions in my macro?

  18. 18

    How can I get the current operating system name in Elixir?

  19. 19

    How can I know amount of cores in the CPU for elixir?

  20. 20

    How can I handle the empty case in Elixir/Phoenix templates?

  21. 21

    How can I do a line break (line continuation) in Elixir?

  22. 22

    Elixir: How can I describe mix.exs settings correctly?

  23. 23

    How can I load a module into another module using Elixir language?

  24. 24

    How can I add LiveView to an existing Elixir/Phoenix app?

  25. 25

    How can I combine css and less using Elixir?

  26. 26

    How can I calculate sum of query results in Elixir?

  27. 27

    How can I profile my elixir phoenix server?

  28. 28

    Replacing sidekiq jobs with Elixir: how can I learn about concurrency?

  29. 29

    How can I print the lowest key of an array?

HotTag

Archive