I am trying to create a Bakeware CLI tool that takes list of servers, opens a terminal for each server, and runs the appropriate ssh command in each. I can then interact with them as needed. However, I cannot get the terminals to execute commands.
Let’s take a simple case:
iex(1)> port = Port.open({:spawn, "urxvt"}, [:binary])
spawns an Elixir process, which spawns an OS process (Linux), which spawns a child process running a terminal program (unicode rxvt). This works, it creates a terminal window.
Since a child process inherits stdin, stdout, and stderr from its parent,
iex(2)> send(port, {self(), {:command, "echo Hello"}})
should send “echo Hello” to stdin of the OS process, which, in turn, should send it to the child process stdin. However, it does not.
How can I open a terminal window and send commands to it?
Thanks!