Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- * Open bash terminal and attach it
- */
- var term = pty.spawn(process.platform === 'win32' ? 'cmd.exe' : 'bash', [], {
- name: 'xterm-color',
- cols: 80,
- rows: 24,
- cwd: 'process.env.PWD',
- env: process.env
- });
- term.on('data', function(data) {
- try {
- ws.send(data);
- } catch (ex) {
- // The WebSocket is not open, ignore
- }
- });
- ws.on('message', function(msg) {
- term.write(msg);
- console.log(term);
- });
- ws.on('close', function () {
- console.log('close');
- process.kill(term.pid);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement