chjj / tty.js

A terminal for your browser, using node/express/socket.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Programatically run commands into terminal

hallahan opened this issue · comments

I'm trying to figure out how to programatically run commands into the terminal.

This get's a string into the terminal, but \n or \r doesn't execute the command.

tty.terms["/dev/ttys001"].write('ls');

How do I programatically ENTER?

Figured it out!

tty.socket.emit('data', '/dev/ttys001', '\r')

If I directly submit \r via the web socket connection, I can get ENTER to the terminal server.