[erlang-questions] Erlang ssh shell question

Mattsson, Tommy <>
Fri Nov 2 10:05:22 CET 2018


Hi,

First time writer here on the erlang questions list :)


I am wondering if anyone knows about how the erlang ssh handles I/O? More details can be found below.


Erlang version: 21.0



Start of SSH server on testing (Windows) machine:

application:ensure_all_started(ssh),
Options = [{system_dir, filename:join(SSHPath, "daemon")}, {user_dir, ?DIR}, {subsystems, [ssh_sftpd:subsystem_spec([{cwd, SSHPath}])]}],

ssh:daemon(?ipaddr, ?port, Options]).

Test module:
-module(sshtest).
sshIO() ->
   io:format("test1~n"),
   io:format("test2\n"),
  test3.


Test run from my own machine:
> ssh $IPADDR 'sshtest:sshIO().'
test3


For some reason any io:format/io:fwrite does not travel back over the SSH connection. If I connect to some Linux machine that already has a (non-erlang) SSH server running and I try to run some random bash script then any echo I have in the script will travel back over the SSH connection.

A test I did with a bash script towards a Linux server,
Bash script (~/test.sh):

echo "test1"

echo "test2"

echo "test3"


Test run from my own machine:
> ssh $IPADDR ./test.sh

test1

test2

test3

This is how I'd like it to work.


I have been googling and reading the documentation for the ssh and related modules to no avail in regards to finding a solution to this problem.

Other than this I/O problem the ssh connection works perfectly for me 😊

Hopefully someone here on the list has some insight into how this works.

Thankful for any help I can get :)
Best regards,

Tommy





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20181102/75f8b2c9/attachment.html>


More information about the erlang-questions mailing list