1.0.0 • Published 2 months ago

node-pty v1.0.0

Weekly downloads
102,158
License
MIT
Repository
github
Last release
2 months ago

node-pty

Build status

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).

1.1.0-beta26

2 months ago

1.1.0-beta25

2 months ago

1.1.0-beta24

2 months ago

1.1.0-beta23

2 months ago

1.1.0-beta22

2 months ago

1.1.0-beta15

4 months ago

1.1.0-beta19

4 months ago

1.1.0-beta18

4 months ago

1.1.0-beta17

4 months ago

1.1.0-beta16

4 months ago

1.1.0-beta21

3 months ago

1.1.0-beta20

4 months ago

1.1.0-beta14

8 months ago

1.1.0-beta13

8 months ago

1.1.0-beta12

9 months ago

1.1.0-beta11

9 months ago

1.1.0-beta10

9 months ago

1.1.0-beta9

9 months ago

1.1.0-beta8

9 months ago

1.1.0-beta7

9 months ago

1.1.0-beta6

10 months ago

1.1.0-beta5

1 year ago

0.11.0-beta33

1 year ago

1.0.0

1 year ago

1.1.0-beta3

1 year ago

1.1.0-beta4

1 year ago

1.1.0-beta1

1 year ago

1.1.0-beta2

1 year ago

0.11.0-beta31

2 years ago

0.11.0-beta30

2 years ago

0.11.0-beta32

2 years ago

0.11.0-beta28

2 years ago

0.11.0-beta29

2 years ago

0.11.0-beta24

2 years ago

0.11.0-beta26

2 years ago

0.11.0-beta25

2 years ago

0.11.0-beta27

2 years ago

0.11.0-beta22

2 years ago

0.11.0-beta23

2 years ago

0.11.0-beta20

2 years ago

0.11.0-beta21

2 years ago

0.11.0-beta19

3 years ago

0.11.0-beta15

3 years ago

0.11.0-beta14

3 years ago

0.11.0-beta17

3 years ago

0.11.0-beta16

3 years ago

0.11.0-beta18

3 years ago

0.11.0-beta13

3 years ago

0.11.0-beta12

3 years ago

0.11.0-beta11

3 years ago

0.11.0-beta10

3 years ago

0.11.0-beta9

3 years ago

0.11.0-beta8

3 years ago

0.10.1

4 years ago

0.11.0-beta6

4 years ago

0.11.0-beta7

4 years ago

0.11.0-beta5

4 years ago

0.11.0-beta4

4 years ago

0.11.0-beta3

4 years ago

0.11.0-beta2

4 years ago

0.11.0-beta1

4 years ago

0.10.0

4 years ago

0.10.0-beta20

4 years ago

0.10.0-beta19

4 years ago

0.10.0-beta18

4 years ago

0.10.0-beta17

4 years ago

0.10.0-beta16

4 years ago

0.10.0-beta15

4 years ago

0.10.0-beta14

4 years ago

0.10.0-beta13

4 years ago

0.10.0-beta12

4 years ago

0.10.0-alpha1

4 years ago

0.10.0-beta11

4 years ago

0.10.0-beta10

4 years ago

0.10.0-beta9

5 years ago

0.10.0-beta8

5 years ago

0.10.0-beta7

5 years ago

0.10.0-beta6

5 years ago

0.10.0-beta5

5 years ago

0.10.0-beta4

5 years ago

0.10.0-beta3

5 years ago

0.10.0-beta2

5 years ago

0.10.0-beta1

5 years ago

0.9.0-beta31

5 years ago

0.9.0-beta30

5 years ago

0.9.0

5 years ago

0.9.0-beta29

5 years ago

0.9.0-beta28

5 years ago

0.9.0-beta27

5 years ago

0.9.0-beta26

5 years ago

0.9.0-beta25

5 years ago

0.9.0-beta24

5 years ago

0.9.0-beta23

5 years ago

0.9.0-beta22

5 years ago

0.9.0-beta21

5 years ago

0.9.0-beta20

5 years ago

0.9.0-beta19

5 years ago

0.9.0-beta18

5 years ago

0.9.0-beta17

5 years ago

0.9.0-beta16

5 years ago

0.9.0-beta15

5 years ago

0.9.0-beta14

5 years ago

0.9.0-beta13

6 years ago

0.9.0-beta12

6 years ago

0.9.0-beta11

6 years ago

0.9.0-beta10

6 years ago

0.9.0-beta9

6 years ago

0.9.0-beta8

6 years ago

0.9.0-beta7

6 years ago

0.9.0-alpha4

6 years ago

0.9.0-alpha3

6 years ago

0.9.0-beta6

6 years ago

0.9.0-beta5

6 years ago

0.9.0-alpha2

6 years ago

0.9.0-alpha1

6 years ago

0.9.0-beta4

6 years ago

0.9.0-beta3

6 years ago

0.9.0-beta2

6 years ago

0.9.0-beta1

6 years ago

0.8.2-beta1

6 years ago

0.8.1

6 years ago

0.8.0

6 years ago

0.7.8-conpty2

6 years ago

0.7.8-conpty1

6 years ago

0.7.6-conpty3

6 years ago

0.7.6-conpty2

6 years ago

0.7.6-conpty1

6 years ago

0.7.8

6 years ago

0.7.7

6 years ago

0.7.6

6 years ago

0.7.5

6 years ago

0.7.4-node-10

6 years ago

0.7.4

7 years ago

0.7.3

7 years ago

0.7.3-beta1

7 years ago

0.7.2

7 years ago

0.7.1

7 years ago

0.7.0

7 years ago

0.6.10

7 years ago

0.6.9

7 years ago

0.6.8

7 years ago

0.6.7

7 years ago

0.6.6

8 years ago

0.6.5

8 years ago

0.6.5-beta1

8 years ago

0.6.4

8 years ago

0.6.3

8 years ago

0.6.3-beta1

8 years ago

0.6.2

8 years ago

0.6.2-beta1

8 years ago

0.6.1

8 years ago

0.6.0

8 years ago

0.6.0-beta3

8 years ago

0.6.0-beta2

8 years ago

0.6.0-beta1

8 years ago

0.5.1

8 years ago

0.5.0-beta5

8 years ago

0.5.0-beta4

8 years ago

0.5.0-beta3

8 years ago

0.5.0-beta2

8 years ago

0.5.0-beta

8 years ago

0.5.0

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.1.0

8 years ago

0.0.1

8 years ago