chjj / tty.js

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

complicated shell problem

adohe-zz opened this issue · comments

I write such code in my server side:

var tty = require('tty.js');

var app = tty.createServer({
  shell: 'mongo test',
  users: {
    foo: 'bar'
  },
  port: 8000
});

app.get('/foo', function(req, res, next) {
  res.send('bar');
});

app.listen();

then I type http://localhost:8000 in my browser and when I click the Open Terminal, the terminal will not show up. And the server side log is:

[tty.js] You should sha1 your user information.
[tty.js] Listening on port 8000.
[tty.js] foo Session foo created.
[tty.js] foo Created pty (id: /dev/ttys004, master: 19, pid: 48143).
[tty.js] foo Closed pty (/dev/ttys004): 19.

It did created pty but closed this as soon as created. But if I run this code:

var tty = require('tty.js');

var app = tty.createServer({
  shell: 'mongo',
  users: {
    foo: 'bar'
  },
  port: 8000
});

app.get('/foo', function(req, res, next) {
  res.send('bar');
});

app.listen();

it is ok. So I am wondering is there anything I did not notice maybe the shell format is wrong. I don't read the source code, so anyone know about this?

Close this since I know how to do it.

@adohe, shell is only the process name. For separate arguments, you'll need to use shellArgs: { shell: 'mongo', shellArgs: ['test'] }.

@chjj yeah, thanks anyway.