GithubHelp home page GithubHelp logo

ak239 / ndb-node-pty Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoft/node-pty

1.0 2.0 0.0 6 MB

Fork node-pty with prebuilt binaries for ndb

License: Other

Python 2.19% JavaScript 2.48% TypeScript 53.99% C++ 41.34%

ndb-node-pty's Introduction

ndb-node-pty

Note: this repository is node-pty fork with two changes:

  • prebuilt binaries for Node 8, Node 9 and Node 10 are shipped as part of package,
  • install script first try to lookup prebuilt binary before building.

forkpty(3) bindings for node.js. This allows you to fork processes with pseudoterminal file descriptors. It returns a terminal object which allows reads and writes.

This is useful for:

  • Writing a terminal emulator (eg. via xterm.js).
  • Getting certain programs to think you're a terminal, such as when you need a program to send you control sequences.

node-pty supports Linux, macOS and Windows. Windows support is possible by utilizing the winpty library.

Real-world Uses

node-pty powers many different terminal emulators, including:

Do you use node-pty in your application as well? Please open a Pull Request to include it here. We would love to have it in our list.

Example Usage

var os = require('os');
var pty = require('node-pty');

var shell = os.platform() === 'win32' ? 'powershell.exe' : 'bash';

var ptyProcess = pty.spawn(shell, [], {
  name: 'xterm-color',
  cols: 80,
  rows: 30,
  cwd: process.env.HOME,
  env: process.env
});

ptyProcess.on('data', function(data) {
  console.log(data);
});

ptyProcess.write('ls\r');
ptyProcess.resize(100, 40);
ptyProcess.write('ls\r');

Building

# Install dependencies and build C++
npm install
# Compile TypeScript -> JavaScript
npm run tsc

Dependencies on Windows

npm install requires some tools to be present in the system like Python and C++ compiler. Windows users can easily install them by running the following command in PowerShell as administrator. For more information see https://github.com/felixrieseberg/windows-build-tools:

npm install --global --production windows-build-tools

Debugging

On Windows, you can show the winpty agent console window by adding the environment variable WINPTY_SHOW_CONSOLE=1 to the pty's environment. See https://github.com/rprichard/winpty#debugging-winpty for more information.

Troubleshooting

Powershell gives error 8009001d

Internal Windows PowerShell error. Loading managed Windows PowerShell failed with error 8009001d.

This happens when PowerShell is launched with no SystemRoot environment variable present.

pty.js

This project is forked from chjj/pty.js with the primary goals being to provide better support for later Node.JS versions and Windows.

License

Copyright (c) 2012-2015, Christopher Jeffrey (MIT License). Copyright (c) 2016, Daniel Imms (MIT License).

ndb-node-pty's People

Contributors

tyriar avatar chjj avatar peters avatar tootallnate avatar jeremyramin avatar zcbenz avatar alexkozy avatar ivankravets avatar daniel-abrecht avatar jerch avatar the-ress avatar rlidwka avatar ioquatix avatar nw avatar marsup avatar joshwilsdon avatar jbenden avatar nightwing avatar heavyk avatar coderaiser avatar vlad-shatskyi avatar vangie avatar implausible avatar svenefftinge avatar rprichard avatar matthew-matvei avatar levrik avatar 19h avatar jacereda avatar jamesmgreene avatar

Stargazers

randomnerd avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.