pax_global_header 0000666 0000000 0000000 00000000064 13553637507 0014530 g ustar 00root root 0000000 0000000 52 comment=beac2b8c8badae230074d88cd0cd08da95daafc5
node-pty-0.9.0/ 0000775 0000000 0000000 00000000000 13553637507 0013275 5 ustar 00root root 0000000 0000000 node-pty-0.9.0/.editorconfig 0000664 0000000 0000000 00000000241 13553637507 0015747 0 ustar 00root root 0000000 0000000 root = true
[*]
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
[*.ts]
max_line_length = 100
node-pty-0.9.0/.gitattributes 0000664 0000000 0000000 00000000014 13553637507 0016163 0 ustar 00root root 0000000 0000000 * text=auto
node-pty-0.9.0/.github/ 0000775 0000000 0000000 00000000000 13553637507 0014635 5 ustar 00root root 0000000 0000000 node-pty-0.9.0/.github/ISSUE_TEMPLATE.md 0000664 0000000 0000000 00000000127 13553637507 0017342 0 ustar 00root root 0000000 0000000 ## Environment details
- OS:
- OS version:
- node-pty version:
## Issue description
node-pty-0.9.0/.gitignore 0000664 0000000 0000000 00000000277 13553637507 0015273 0 ustar 00root root 0000000 0000000 build/
.lock-wscript
out/
Makefile.gyp
*.Makefile
*.target.gyp.mk
node_modules/
builderror.log
lib/
npm-debug.log
package-lock.json
fixtures/space folder/
.vscode/settings.json
.vscode/ipch/
node-pty-0.9.0/.npmignore 0000664 0000000 0000000 00000000013 13553637507 0015266 0 ustar 00root root 0000000 0000000 *.test.ts
node-pty-0.9.0/.npmrc 0000664 0000000 0000000 00000000044 13553637507 0014413 0 ustar 00root root 0000000 0000000 unsafe-perm=true
package-lock=false
node-pty-0.9.0/.vscode/ 0000775 0000000 0000000 00000000000 13553637507 0014636 5 ustar 00root root 0000000 0000000 node-pty-0.9.0/.vscode/launch.json 0000664 0000000 0000000 00000001776 13553637507 0017016 0 ustar 00root root 0000000 0000000 {
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Unit Tests",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/mocha",
"windows": {
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/mocha.cmd"
},
"runtimeArgs": [
"--colors",
"--recursive",
"${workspaceRoot}/lib/**/*.test.js"
],
"env": {
"NODE_PATH": "${workspaceRoot}/lib"
},
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/lib/**/*.js"
],
"internalConsoleOptions": "openOnSessionStart"
},
{
"type": "node",
"request": "attach",
"name": "Attach to process ID",
"processId": "${command:PickProcess}"
}
]
}
node-pty-0.9.0/LICENSE 0000664 0000000 0000000 00000006376 13553637507 0014316 0 ustar 00root root 0000000 0000000 Copyright (c) 2012-2015, Christopher Jeffrey (https://github.com/chjj/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
The MIT License (MIT)
Copyright (c) 2016, Daniel Imms (http://www.growingwiththeweb.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License
Copyright (c) 2018 - present Microsoft Corporation
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
node-pty-0.9.0/README.md 0000664 0000000 0000000 00000013022 13553637507 0014552 0 ustar 00root root 0000000 0000000 # node-pty
[](https://dev.azure.com/vscode/node-pty/_build/latest?definitionId=11)
`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](https://github.com/sourcelair/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 [Windows conpty API](https://blogs.msdn.microsoft.com/commandline/2018/08/02/windows-command-line-introducing-the-windows-pseudo-console-conpty/) on Windows 1809+ and the [winpty](https://github.com/rprichard/winpty) library in older version.
## Real-world Uses
`node-pty` powers many different terminal emulators, including:
- [Microsoft Visual Studio Code](https://code.visualstudio.com)
- [Hyper](https://hyper.is/)
- [Upterm](https://github.com/railsware/upterm)
- [Script Runner](https://github.com/ioquatix/script-runner) for Atom.
- [Theia](https://github.com/theia-ide/theia)
- [FreeMAN](https://github.com/matthew-matvei/freeman) file manager
- [atom-xterm](https://atom.io/packages/atom-xterm) - Atom plugin for providing terminals inside your Atom workspace.
- [Termination](https://atom.io/packages/termination) - Another Atom plugin that provides terminals inside your Atom workspace.
- [electerm](https://github.com/electerm/electerm) Terminal/ssh/sftp client(linux, mac, win).
- [Extraterm](http://extraterm.org/)
- [Wetty](https://github.com/krishnasrinivas/wetty) Browser based Terminal over HTTP and HTTPS
Do you use node-pty in your application as well? Please open a [Pull Request](https://github.com/Tyriar/node-pty/pulls) to include it here. We would love to have it in our list.
## Example Usage
```js
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) {
process.stdout.write(data);
});
ptyProcess.write('ls\r');
ptyProcess.resize(100, 40);
ptyProcess.write('ls\r');
```
## Building
```bash
# Install dependencies and build C++
npm install
# Compile TypeScript -> JavaScript
npm run tsc
```
## Dependencies
### Linux/Ubuntu
```
sudo apt install -y make python build-essential
```
The following are also needed:
- Node.JS 10+
### 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:
```sh
npm install --global --production windows-build-tools
```
The following are also needed:
- [Windows SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk) - only the "Desktop C++ Apps" components are needed to be installed
- Node.JS 10+
## Debugging
[The wiki](https://github.com/Microsoft/node-pty/wiki/Debugging) contains instructions for debugging node-pty.
## Security
All processes launched from node-pty will launch at the same permission level of the parent process. Take care particularly when using node-pty inside a server that's accessible on the internet. We recommend launching the pty inside a container to protect your host machine.
## Thread Safety
Note that node-pty is not thread safe so running it across multiple worker threads in node.js could cause issues.
## Flow Control
Automatic flow control can be enabled by either providing `handleFlowControl = true` in the constructor options or setting it later on:
```js
const PAUSE = '\x13'; // XOFF
const RESUME = '\x11'; // XON
const ptyProcess = pty.spawn(shell, [], {handleFlowControl: true});
// flow control in action
ptyProcess.write(PAUSE); // pty will block and pause the slave program
...
ptyProcess.write(RESUME); // pty will enter flow mode and resume the slave program
// temporarily disable/re-enable flow control
ptyProcess.handleFlowControl = false;
...
ptyProcess.handleFlowControl = true;
```
By default `PAUSE` and `RESUME` are XON/XOFF control codes (as shown above). To avoid conflicts in environments that use these control codes for different purposes the messages can be customized as `flowControlPause: string` and `flowControlResume: string` in the constructor options. `PAUSE` and `RESUME` are not passed to the underlying pseudoterminal if flow control is enabled.
## 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.
### ConnectNamedPipe failed: Windows error 232
This error can occur due to anti-virus software intercepting winpty from creating a pty. To workaround this you can exclude this file from your anti-virus scanning `node-pty\build\Release\winpty-agent.exe`
## pty.js
This project is forked from [chjj/pty.js](https://github.com/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).
Copyright (c) 2018, Microsoft Corporation (MIT License).
node-pty-0.9.0/azure-pipelines.yml 0000664 0000000 0000000 00000004627 13553637507 0017145 0 ustar 00root root 0000000 0000000 # Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
jobs:
- job: Linux
pool:
vmImage: 'ubuntu-16.04'
strategy:
matrix:
node_8_x:
node_version: 8.x
node_9_x:
node_version: 9.x
node_10_x:
node_version: 10.x
node_11_x:
node_version: 11.x
node_12_x:
node_version: 12.x
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'
- script: |
npm i
displayName: 'Install dependencies and build'
- script: |
npm test
displayName: 'Test'
- script: |
npm run lint
displayName: 'Lint'
- job: macOS
pool:
vmImage: 'xcode9-macos10.13'
strategy:
matrix:
node_8_x:
node_version: 8.x
node_9_x:
node_version: 9.x
node_10_x:
node_version: 10.x
node_11_x:
node_version: 11.x
node_12_x:
node_version: 12.x
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'
- script: |
npm i
displayName: 'Install dependencies and build'
- script: |
npm test
displayName: 'Test'
- script: |
npm run lint
displayName: 'Lint'
- job: Windows
pool:
vmImage: 'vs2017-win2016'
strategy:
matrix:
node_8_x:
node_version: 8.x
node_9_x:
node_version: 9.x
node_10_x:
node_version: 10.x
node_11_x:
node_version: 11.x
node_12_x:
node_version: 12.x
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'
- script: |
npm i
displayName: 'Install dependencies and build'
- script: |
npm test
displayName: 'Test'
- script: |
npm run lint
displayName: 'Lint'
- job: Release
dependsOn:
- Linux
- macOS
- Windows
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: NodeTool@0
inputs:
versionSpec: '8.x'
displayName: 'Install Node.js'
- script: |
npm i
displayName: 'Install dependencies and build'
- script: |
NPM_AUTH_TOKEN="$(NPM_AUTH_TOKEN)" node ./scripts/publish.js
displayName: 'Publish to npm'
node-pty-0.9.0/binding.gyp 0000664 0000000 0000000 00000004230 13553637507 0015427 0 ustar 00root root 0000000 0000000 {
'conditions': [
['OS=="win"', {
'targets': [
{
'target_name': 'conpty',
'include_dirs' : [
'