Skip to content

Commit

Permalink
replace dirty binary with proof of concept js
Browse files Browse the repository at this point in the history
  • Loading branch information
butlerx committed Feb 25, 2018
1 parent b0838ae commit fc01302
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Binary file removed bin/buffer
Binary file not shown.
16 changes: 16 additions & 0 deletions 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 changes: 5 additions & 1 deletion lib/term.mjs
Expand Up @@ -42,7 +42,11 @@ export default class Term {
}

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 = '';
return new Promise((resolve, reject) => {
term.on('exit', () => {
Expand Down

0 comments on commit fc01302

Please sign in to comment.