Skip to content

Commit 61a5d2a

Browse files
authored
Add an option to disable input to the terminal
Gottox#10
1 parent bbb6ae3 commit 61a5d2a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

app.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ var http = require('http'),
1818
ss = require('socket.io-stream');
1919

2020
var config = require('./config.json');
21+
var use_input = true;
22+
if (config["input"] != null)
23+
use_input = config["input"];
2124

2225
var server = http.createServer()
2326
.listen(config.port, config.interface);
@@ -56,7 +59,12 @@ socketio(server).of('pty').on('connection', function(socket) {
5659
var name = options.name;
5760

5861
var pty = child_pty.spawn('/bin/sh', ['-c', config.login], options);
59-
pty.stdout.pipe(stream).pipe(pty.stdin);
62+
if (use_input)
63+
pty.stdout.pipe(stream).pipe(pty.stdin);
64+
else {
65+
pty.stdout.pipe(stream);
66+
stream.on('data', function(chunk) {});
67+
}
6068
ptys[name] = pty;
6169
socket.on('disconnect', function() {
6270
console.log("end");

0 commit comments

Comments
 (0)