Browse Source

replace dirty binary with proof of concept js

pull/126/head
butlerx 7 years ago
parent
commit
fc013020d2
No known key found for this signature in database GPG Key ID: B37CA765BAA89170
  1. BIN
      bin/buffer
  2. 16
      lib/buffer.mjs
  3. 6
      lib/term.mjs

BIN
bin/buffer

Binary file not shown.

16
lib/buffer.mjs

@ -0,0 +1,16 @@
import rl from 'readline';
ask('Enter your username');
export default function ask(question) {
const r = rl.createInterface({
input: process.stdin,
output: process.stdout,
});
return new Promise(resolve => {
r.question(`${question}: `, answer => {
r.close();
resolve(answer);
});
});
}

6
lib/term.mjs

@ -42,7 +42,11 @@ export default class Term {
} }
static login(socket) { static login(socket) {
const term = spawn('./bin/buffer', [], xterm); const term = spawn(
'/usr/bin/env',
['node', '-r', '@std/esm', './lib/buffer.mjs'],
xterm
);
let buf = ''; let buf = '';
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
term.on('exit', () => { term.on('exit', () => {

Loading…
Cancel
Save