daily pastebin goal
12%
SHARE
TWEET

Untitled

a guest Mar 20th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. * Open bash terminal and attach it
  2.    */
  3.   var term = pty.spawn(process.platform === 'win32' ? 'cmd.exe' : 'bash', [], {
  4.     name: 'xterm-color',
  5.     cols: 80,
  6.     rows: 24,
  7.     cwd: 'process.env.PWD',
  8.     env: process.env
  9.   });
  10.   term.on('data', function(data) {
  11.     try {
  12.       ws.send(data);
  13.     } catch (ex) {
  14.       // The WebSocket is not open, ignore
  15.     }
  16.   });
  17.   ws.on('message', function(msg) {
  18.     term.write(msg);
  19.     console.log(term);
  20.   });
  21.  
  22.   ws.on('close', function () {
  23.     console.log('close');
  24.     process.kill(term.pid);
  25.   });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top