@termiq/cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +54 -0
- package/README.md +61 -0
- package/dist/bin.js +102 -0
- package/dist/node_modules/node-pty/LICENSE +69 -0
- package/dist/node_modules/node-pty/README.md +165 -0
- package/dist/node_modules/node-pty/lib/conpty_console_list_agent.js +16 -0
- package/dist/node_modules/node-pty/lib/conpty_console_list_agent.js.map +1 -0
- package/dist/node_modules/node-pty/lib/eventEmitter2.js +47 -0
- package/dist/node_modules/node-pty/lib/eventEmitter2.js.map +1 -0
- package/dist/node_modules/node-pty/lib/eventEmitter2.test.js +30 -0
- package/dist/node_modules/node-pty/lib/eventEmitter2.test.js.map +1 -0
- package/dist/node_modules/node-pty/lib/index.js +52 -0
- package/dist/node_modules/node-pty/lib/index.js.map +1 -0
- package/dist/node_modules/node-pty/lib/interfaces.js +7 -0
- package/dist/node_modules/node-pty/lib/interfaces.js.map +1 -0
- package/dist/node_modules/node-pty/lib/shared/conout.js +11 -0
- package/dist/node_modules/node-pty/lib/shared/conout.js.map +1 -0
- package/dist/node_modules/node-pty/lib/terminal.js +190 -0
- package/dist/node_modules/node-pty/lib/terminal.js.map +1 -0
- package/dist/node_modules/node-pty/lib/terminal.test.js +139 -0
- package/dist/node_modules/node-pty/lib/terminal.test.js.map +1 -0
- package/dist/node_modules/node-pty/lib/testUtils.test.js +28 -0
- package/dist/node_modules/node-pty/lib/testUtils.test.js.map +1 -0
- package/dist/node_modules/node-pty/lib/types.js +7 -0
- package/dist/node_modules/node-pty/lib/types.js.map +1 -0
- package/dist/node_modules/node-pty/lib/unixTerminal.js +346 -0
- package/dist/node_modules/node-pty/lib/unixTerminal.js.map +1 -0
- package/dist/node_modules/node-pty/lib/unixTerminal.test.js +351 -0
- package/dist/node_modules/node-pty/lib/unixTerminal.test.js.map +1 -0
- package/dist/node_modules/node-pty/lib/utils.js +39 -0
- package/dist/node_modules/node-pty/lib/utils.js.map +1 -0
- package/dist/node_modules/node-pty/lib/windowsConoutConnection.js +125 -0
- package/dist/node_modules/node-pty/lib/windowsConoutConnection.js.map +1 -0
- package/dist/node_modules/node-pty/lib/windowsPtyAgent.js +320 -0
- package/dist/node_modules/node-pty/lib/windowsPtyAgent.js.map +1 -0
- package/dist/node_modules/node-pty/lib/windowsPtyAgent.test.js +90 -0
- package/dist/node_modules/node-pty/lib/windowsPtyAgent.test.js.map +1 -0
- package/dist/node_modules/node-pty/lib/windowsTerminal.js +199 -0
- package/dist/node_modules/node-pty/lib/windowsTerminal.js.map +1 -0
- package/dist/node_modules/node-pty/lib/windowsTerminal.test.js +219 -0
- package/dist/node_modules/node-pty/lib/windowsTerminal.test.js.map +1 -0
- package/dist/node_modules/node-pty/lib/worker/conoutSocketWorker.js +22 -0
- package/dist/node_modules/node-pty/lib/worker/conoutSocketWorker.js.map +1 -0
- package/dist/node_modules/node-pty/node-addon-api@7.1.1/node_modules/node-addon-api/node_addon_api_except.stamp +0 -0
- package/dist/node_modules/node-pty/package.json +64 -0
- package/dist/node_modules/node-pty/prebuilds/darwin-arm64/pty.node +0 -0
- package/dist/node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper +0 -0
- package/dist/node_modules/node-pty/prebuilds/darwin-x64/pty.node +0 -0
- package/dist/node_modules/node-pty/prebuilds/darwin-x64/spawn-helper +0 -0
- package/dist/node_modules/node-pty/prebuilds/linux-x64/pty.node +0 -0
- package/dist/node_modules/node-pty/prebuilds/win32-arm64/conpty/OpenConsole.exe +0 -0
- package/dist/node_modules/node-pty/prebuilds/win32-arm64/conpty/conpty.dll +0 -0
- package/dist/node_modules/node-pty/prebuilds/win32-arm64/conpty.node +0 -0
- package/dist/node_modules/node-pty/prebuilds/win32-arm64/conpty_console_list.node +0 -0
- package/dist/node_modules/node-pty/prebuilds/win32-arm64/pty.node +0 -0
- package/dist/node_modules/node-pty/prebuilds/win32-arm64/winpty-agent.exe +0 -0
- package/dist/node_modules/node-pty/prebuilds/win32-arm64/winpty.dll +0 -0
- package/dist/node_modules/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
- package/dist/node_modules/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
- package/dist/node_modules/node-pty/prebuilds/win32-x64/conpty.node +0 -0
- package/dist/node_modules/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
- package/dist/node_modules/node-pty/prebuilds/win32-x64/pty.node +0 -0
- package/dist/node_modules/node-pty/prebuilds/win32-x64/winpty-agent.exe +0 -0
- package/dist/node_modules/node-pty/prebuilds/win32-x64/winpty.dll +0 -0
- package/dist/node_modules/node-pty/typings/node-pty.d.ts +211 -0
- package/package.json +48 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Copyright (c) 2012-2015, Christopher Jeffrey (https://github.com/chjj/)
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
The MIT License (MIT)
|
|
24
|
+
|
|
25
|
+
Copyright (c) 2016, Daniel Imms (http://www.growingwiththeweb.com)
|
|
26
|
+
|
|
27
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
28
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
29
|
+
in the Software without restriction, including without limitation the rights
|
|
30
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
31
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
32
|
+
furnished to do so, subject to the following conditions:
|
|
33
|
+
|
|
34
|
+
The above copyright notice and this permission notice shall be included in all
|
|
35
|
+
copies or substantial portions of the Software.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
38
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
39
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
40
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
41
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
42
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
43
|
+
SOFTWARE.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
MIT License
|
|
48
|
+
|
|
49
|
+
Copyright (c) 2018 - present Microsoft Corporation
|
|
50
|
+
|
|
51
|
+
All rights reserved.
|
|
52
|
+
|
|
53
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
54
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
55
|
+
in the Software without restriction, including without limitation the rights
|
|
56
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
57
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
58
|
+
furnished to do so, subject to the following conditions:
|
|
59
|
+
|
|
60
|
+
The above copyright notice and this permission notice shall be included in all
|
|
61
|
+
copies or substantial portions of the Software.
|
|
62
|
+
|
|
63
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
64
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
65
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
66
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
67
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
68
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
69
|
+
SOFTWARE.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# node-pty
|
|
2
|
+
|
|
3
|
+
[](https://dev.azure.com/vscode/node-pty/_build/latest?definitionId=11&branchName=main)
|
|
4
|
+
|
|
5
|
+
`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.
|
|
6
|
+
|
|
7
|
+
This is useful for:
|
|
8
|
+
|
|
9
|
+
- Writing a terminal emulator (eg. via [xterm.js](https://github.com/sourcelair/xterm.js)).
|
|
10
|
+
- Getting certain programs to *think* you're a terminal, such as when you need a program to send you control sequences.
|
|
11
|
+
|
|
12
|
+
`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.
|
|
13
|
+
|
|
14
|
+
## API
|
|
15
|
+
|
|
16
|
+
The full API for node-pty is contained within the [TypeScript declaration file](https://github.com/microsoft/node-pty/blob/main/typings/node-pty.d.ts), use the branch/tag picker in GitHub (`w`) to navigate to the correct version of the API.
|
|
17
|
+
|
|
18
|
+
## Example Usage
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
import * as os from 'node:os';
|
|
22
|
+
import * as pty from 'node-pty';
|
|
23
|
+
|
|
24
|
+
const shell = os.platform() === 'win32' ? 'powershell.exe' : 'bash';
|
|
25
|
+
|
|
26
|
+
const ptyProcess = pty.spawn(shell, [], {
|
|
27
|
+
name: 'xterm-color',
|
|
28
|
+
cols: 80,
|
|
29
|
+
rows: 30,
|
|
30
|
+
cwd: process.env.HOME,
|
|
31
|
+
env: process.env
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
ptyProcess.onData((data) => {
|
|
35
|
+
process.stdout.write(data);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
ptyProcess.write('ls\r');
|
|
39
|
+
ptyProcess.resize(100, 40);
|
|
40
|
+
ptyProcess.write('ls\r');
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Real-world Uses
|
|
44
|
+
|
|
45
|
+
`node-pty` powers many different terminal emulators, including:
|
|
46
|
+
|
|
47
|
+
- [Microsoft Visual Studio Code](https://code.visualstudio.com)
|
|
48
|
+
- [Hyper](https://hyper.is/)
|
|
49
|
+
- [Upterm](https://github.com/railsware/upterm)
|
|
50
|
+
- [Script Runner](https://github.com/ioquatix/script-runner) for Atom.
|
|
51
|
+
- [Theia](https://github.com/theia-ide/theia)
|
|
52
|
+
- [FreeMAN](https://github.com/matthew-matvei/freeman) file manager
|
|
53
|
+
- [terminus](https://atom.io/packages/terminus) - An Atom plugin for providing terminals inside your Atom workspace.
|
|
54
|
+
- [x-terminal](https://atom.io/packages/x-terminal) - Also an Atom plugin that provides terminals inside your Atom workspace.
|
|
55
|
+
- [Termination](https://atom.io/packages/termination) - Also an Atom plugin that provides terminals inside your Atom workspace.
|
|
56
|
+
- [atom-xterm](https://atom.io/packages/atom-xterm) - Also an Atom plugin that provides terminals inside your Atom workspace.
|
|
57
|
+
- [electerm](https://github.com/electerm/electerm) Terminal/SSH/SFTP client(Linux, macOS, Windows).
|
|
58
|
+
- [Extraterm](http://extraterm.org/)
|
|
59
|
+
- [Wetty](https://github.com/krishnasrinivas/wetty) Browser based Terminal over HTTP and HTTPS
|
|
60
|
+
- [nomad](https://github.com/lukebarnard1/nomad-term)
|
|
61
|
+
- [DockerStacks](https://github.com/sfx101/docker-stacks) Local LAMP/LEMP stack using Docker
|
|
62
|
+
- [TeleType](https://github.com/akshaykmr/TeleType): cli tool that allows you to share your terminal online conveniently. Show off mad cli-fu, help a colleague, teach, or troubleshoot.
|
|
63
|
+
- [mesos-term](https://github.com/criteo/mesos-term): A web terminal for Apache Mesos. It allows to execute commands within containers.
|
|
64
|
+
- [Commas](https://github.com/CyanSalt/commas): A hackable terminal and command runner.
|
|
65
|
+
- [ENiGMA½ BBS Software](https://github.com/NuSkooler/enigma-bbs): A modern BBS software with a nostalgic flair!
|
|
66
|
+
- [Tinkerun](https://github.com/tinkerun/tinkerun): A new way of running Tinker.
|
|
67
|
+
- [Tess](https://tessapp.dev): Hackable, simple and rapid terminal for the new era of technology 👍
|
|
68
|
+
- [NxShell](https://nxshell.github.io/): An easy to use new terminal for Windows/Linux/MacOS platform.
|
|
69
|
+
- [OpenSumi](https://github.com/opensumi/core): A framework helps you quickly build Cloud or Desktop IDE products.
|
|
70
|
+
- [Enjoy Git](https://github.com/huangcs427/enjoy-git-release): A modern Git client featuring an intuitive user interface, built with Electron, Vue 3, and TypeScript.
|
|
71
|
+
|
|
72
|
+
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.
|
|
73
|
+
|
|
74
|
+
## Building
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Install dependencies and build C++
|
|
78
|
+
npm install
|
|
79
|
+
# Compile TypeScript -> JavaScript
|
|
80
|
+
npm run build
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Dependencies
|
|
84
|
+
|
|
85
|
+
Node.JS 16 or Electron 19 is required to use `node-pty`. What version of node is supported is currently mostly bound to [whatever version Visual Studio Code is using](https://github.com/microsoft/node-pty/issues/557#issuecomment-1332193541).
|
|
86
|
+
|
|
87
|
+
### Linux (apt)
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
sudo apt install -y make python build-essential
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### macOS
|
|
94
|
+
|
|
95
|
+
Xcode is needed to compile the sources, this can be installed from the App Store.
|
|
96
|
+
|
|
97
|
+
### Windows
|
|
98
|
+
|
|
99
|
+
`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:
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
npm install --global --production windows-build-tools
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The following are also needed:
|
|
106
|
+
|
|
107
|
+
- [Windows SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk) - only the "Desktop C++ Apps" components are needed to be installed
|
|
108
|
+
- Spectre-mitigated libraries - In order to avoid the build error "MSB8040: Spectre-mitigated libraries are required for this project", open the Visual Studio Installer, press the Modify button, navigate to the "Individual components" tab, search "Spectre", and install an option like "MSVC v143 - VS 2022 C++ x64/x86 Spectre-mitigated libs (Latest)" (the exact option to install will depend on your version of Visual Studio as well as your operating system architecture)
|
|
109
|
+
|
|
110
|
+
## Debugging
|
|
111
|
+
|
|
112
|
+
[The wiki](https://github.com/Microsoft/node-pty/wiki/Debugging) contains instructions for debugging node-pty.
|
|
113
|
+
|
|
114
|
+
## Security
|
|
115
|
+
|
|
116
|
+
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.
|
|
117
|
+
|
|
118
|
+
## Thread Safety
|
|
119
|
+
|
|
120
|
+
Note that node-pty is not thread safe so running it across multiple worker threads in node.js could cause issues.
|
|
121
|
+
|
|
122
|
+
## Flow Control
|
|
123
|
+
|
|
124
|
+
Automatic flow control can be enabled by either providing `handleFlowControl = true` in the constructor options or setting it later on:
|
|
125
|
+
|
|
126
|
+
```js
|
|
127
|
+
const PAUSE = '\x13'; // XOFF
|
|
128
|
+
const RESUME = '\x11'; // XON
|
|
129
|
+
|
|
130
|
+
const ptyProcess = pty.spawn(shell, [], {handleFlowControl: true});
|
|
131
|
+
|
|
132
|
+
// flow control in action
|
|
133
|
+
ptyProcess.write(PAUSE); // pty will block and pause the child program
|
|
134
|
+
...
|
|
135
|
+
ptyProcess.write(RESUME); // pty will enter flow mode and resume the child program
|
|
136
|
+
|
|
137
|
+
// temporarily disable/re-enable flow control
|
|
138
|
+
ptyProcess.handleFlowControl = false;
|
|
139
|
+
...
|
|
140
|
+
ptyProcess.handleFlowControl = true;
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
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.
|
|
144
|
+
|
|
145
|
+
## Troubleshooting
|
|
146
|
+
|
|
147
|
+
### Powershell gives error 8009001d
|
|
148
|
+
|
|
149
|
+
> Internal Windows PowerShell error. Loading managed Windows PowerShell failed with error 8009001d.
|
|
150
|
+
|
|
151
|
+
This happens when PowerShell is launched with no `SystemRoot` environment variable present.
|
|
152
|
+
|
|
153
|
+
### ConnectNamedPipe failed: Windows error 232
|
|
154
|
+
|
|
155
|
+
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`
|
|
156
|
+
|
|
157
|
+
## pty.js
|
|
158
|
+
|
|
159
|
+
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.
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
Copyright (c) 2012-2015, Christopher Jeffrey (MIT License).<br>
|
|
164
|
+
Copyright (c) 2016, Daniel Imms (MIT License).<br>
|
|
165
|
+
Copyright (c) 2018, Microsoft Corporation (MIT License).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2019, Microsoft Corporation (MIT License).
|
|
4
|
+
*
|
|
5
|
+
* This module fetches the console process list for a particular PID. It must be
|
|
6
|
+
* called from a different process (child_process.fork) as there can only be a
|
|
7
|
+
* single console attached to a process.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
var utils_1 = require("./utils");
|
|
11
|
+
var getConsoleProcessList = utils_1.loadNativeModule('conpty_console_list').module.getConsoleProcessList;
|
|
12
|
+
var shellPid = parseInt(process.argv[2], 10);
|
|
13
|
+
var consoleProcessList = getConsoleProcessList(shellPid);
|
|
14
|
+
process.send({ consoleProcessList: consoleProcessList });
|
|
15
|
+
process.exit(0);
|
|
16
|
+
//# sourceMappingURL=conpty_console_list_agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conpty_console_list_agent.js","sourceRoot":"","sources":["../src/conpty_console_list_agent.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,iCAA2C;AAE3C,IAAM,qBAAqB,GAAG,wBAAgB,CAAC,qBAAqB,CAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC;AACnG,IAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC/C,IAAM,kBAAkB,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;AAC3D,OAAO,CAAC,IAAK,CAAC,EAAE,kBAAkB,oBAAA,EAAE,CAAC,CAAC;AACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2019, Microsoft Corporation (MIT License).
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.EventEmitter2 = void 0;
|
|
7
|
+
var EventEmitter2 = /** @class */ (function () {
|
|
8
|
+
function EventEmitter2() {
|
|
9
|
+
this._listeners = [];
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(EventEmitter2.prototype, "event", {
|
|
12
|
+
get: function () {
|
|
13
|
+
var _this = this;
|
|
14
|
+
if (!this._event) {
|
|
15
|
+
this._event = function (listener) {
|
|
16
|
+
_this._listeners.push(listener);
|
|
17
|
+
var disposable = {
|
|
18
|
+
dispose: function () {
|
|
19
|
+
for (var i = 0; i < _this._listeners.length; i++) {
|
|
20
|
+
if (_this._listeners[i] === listener) {
|
|
21
|
+
_this._listeners.splice(i, 1);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return disposable;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return this._event;
|
|
31
|
+
},
|
|
32
|
+
enumerable: false,
|
|
33
|
+
configurable: true
|
|
34
|
+
});
|
|
35
|
+
EventEmitter2.prototype.fire = function (data) {
|
|
36
|
+
var queue = [];
|
|
37
|
+
for (var i = 0; i < this._listeners.length; i++) {
|
|
38
|
+
queue.push(this._listeners[i]);
|
|
39
|
+
}
|
|
40
|
+
for (var i = 0; i < queue.length; i++) {
|
|
41
|
+
queue[i].call(undefined, data);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return EventEmitter2;
|
|
45
|
+
}());
|
|
46
|
+
exports.EventEmitter2 = EventEmitter2;
|
|
47
|
+
//# sourceMappingURL=eventEmitter2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventEmitter2.js","sourceRoot":"","sources":["../src/eventEmitter2.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAYH;IAAA;QACU,eAAU,GAAmB,EAAE,CAAC;IAgC1C,CAAC;IA7BC,sBAAW,gCAAK;aAAhB;YAAA,iBAkBC;YAjBC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;gBAChB,IAAI,CAAC,MAAM,GAAG,UAAC,QAAuB;oBACpC,KAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;oBAC/B,IAAM,UAAU,GAAG;wBACjB,OAAO,EAAE;4BACP,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gCAC/C,IAAI,KAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;oCACnC,KAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;oCAC7B,OAAO;iCACR;6BACF;wBACH,CAAC;qBACF,CAAC;oBACF,OAAO,UAAU,CAAC;gBACpB,CAAC,CAAC;aACH;YACD,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;;;OAAA;IAEM,4BAAI,GAAX,UAAY,IAAO;QACjB,IAAM,KAAK,GAAmB,EAAE,CAAC;QACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC/C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;SAChC;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACrC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;SAChC;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AAjCD,IAiCC;AAjCY,sCAAa"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2019, Microsoft Corporation (MIT License).
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var assert = require("assert");
|
|
7
|
+
var eventEmitter2_1 = require("./eventEmitter2");
|
|
8
|
+
describe('EventEmitter2', function () {
|
|
9
|
+
it('should fire listeners multiple times', function () {
|
|
10
|
+
var order = [];
|
|
11
|
+
var emitter = new eventEmitter2_1.EventEmitter2();
|
|
12
|
+
emitter.event(function (data) { return order.push(data + 'a'); });
|
|
13
|
+
emitter.event(function (data) { return order.push(data + 'b'); });
|
|
14
|
+
emitter.fire(1);
|
|
15
|
+
emitter.fire(2);
|
|
16
|
+
assert.deepEqual(order, ['1a', '1b', '2a', '2b']);
|
|
17
|
+
});
|
|
18
|
+
it('should not fire listeners once disposed', function () {
|
|
19
|
+
var order = [];
|
|
20
|
+
var emitter = new eventEmitter2_1.EventEmitter2();
|
|
21
|
+
emitter.event(function (data) { return order.push(data + 'a'); });
|
|
22
|
+
var disposeB = emitter.event(function (data) { return order.push(data + 'b'); });
|
|
23
|
+
emitter.event(function (data) { return order.push(data + 'c'); });
|
|
24
|
+
emitter.fire(1);
|
|
25
|
+
disposeB.dispose();
|
|
26
|
+
emitter.fire(2);
|
|
27
|
+
assert.deepEqual(order, ['1a', '1b', '1c', '2a', '2c']);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=eventEmitter2.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,EAAtB,CAAsB,CAAC,CAAC;QAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,QAAQ,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,CAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAE,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2012-2015, Christopher Jeffrey, Peter Sunde (MIT License)
|
|
4
|
+
* Copyright (c) 2016, Daniel Imms (MIT License).
|
|
5
|
+
* Copyright (c) 2018, Microsoft Corporation (MIT License).
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.native = exports.open = exports.createTerminal = exports.fork = exports.spawn = void 0;
|
|
9
|
+
var utils_1 = require("./utils");
|
|
10
|
+
var terminalCtor;
|
|
11
|
+
if (process.platform === 'win32') {
|
|
12
|
+
terminalCtor = require('./windowsTerminal').WindowsTerminal;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
terminalCtor = require('./unixTerminal').UnixTerminal;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Forks a process as a pseudoterminal.
|
|
19
|
+
* @param file The file to launch.
|
|
20
|
+
* @param args The file's arguments as argv (string[]) or in a pre-escaped
|
|
21
|
+
* CommandLine format (string). Note that the CommandLine option is only
|
|
22
|
+
* available on Windows and is expected to be escaped properly.
|
|
23
|
+
* @param options The options of the terminal.
|
|
24
|
+
* @throws When the file passed to spawn with does not exists.
|
|
25
|
+
* @see CommandLineToArgvW https://msdn.microsoft.com/en-us/library/windows/desktop/bb776391(v=vs.85).aspx
|
|
26
|
+
* @see Parsing C++ Comamnd-Line Arguments https://msdn.microsoft.com/en-us/library/17w5ykft.aspx
|
|
27
|
+
* @see GetCommandLine https://msdn.microsoft.com/en-us/library/windows/desktop/ms683156.aspx
|
|
28
|
+
*/
|
|
29
|
+
function spawn(file, args, opt) {
|
|
30
|
+
return new terminalCtor(file, args, opt);
|
|
31
|
+
}
|
|
32
|
+
exports.spawn = spawn;
|
|
33
|
+
/** @deprecated */
|
|
34
|
+
function fork(file, args, opt) {
|
|
35
|
+
return new terminalCtor(file, args, opt);
|
|
36
|
+
}
|
|
37
|
+
exports.fork = fork;
|
|
38
|
+
/** @deprecated */
|
|
39
|
+
function createTerminal(file, args, opt) {
|
|
40
|
+
return new terminalCtor(file, args, opt);
|
|
41
|
+
}
|
|
42
|
+
exports.createTerminal = createTerminal;
|
|
43
|
+
function open(options) {
|
|
44
|
+
return terminalCtor.open(options);
|
|
45
|
+
}
|
|
46
|
+
exports.open = open;
|
|
47
|
+
/**
|
|
48
|
+
* Expose the native API when not Windows, note that this is not public API and
|
|
49
|
+
* could be removed at any time.
|
|
50
|
+
*/
|
|
51
|
+
exports.native = (process.platform !== 'win32' ? utils_1.loadNativeModule('pty').module : null);
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAIH,iCAA2C;AAE3C,IAAI,YAAiB,CAAC;AACtB,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;IAChC,YAAY,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,eAAe,CAAC;CAC7D;KAAM;IACL,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,YAAY,CAAC;CACvD;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,KAAK,CAAC,IAAa,EAAE,IAAwB,EAAE,GAA8C;IAC3G,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;AAC3C,CAAC;AAFD,sBAEC;AAED,kBAAkB;AAClB,SAAgB,IAAI,CAAC,IAAa,EAAE,IAAwB,EAAE,GAA8C;IAC1G,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;AAC3C,CAAC;AAFD,oBAEC;AAED,kBAAkB;AAClB,SAAgB,cAAc,CAAC,IAAa,EAAE,IAAwB,EAAE,GAA8C;IACpH,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;AAC3C,CAAC;AAFD,wCAEC;AAED,SAAgB,IAAI,CAAC,OAAwB;IAC3C,OAAO,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC;AAFD,oBAEC;AAED;;;GAGG;AACU,QAAA,MAAM,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,wBAAgB,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2020, Microsoft Corporation (MIT License).
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getWorkerPipeName = void 0;
|
|
7
|
+
function getWorkerPipeName(conoutPipeName) {
|
|
8
|
+
return conoutPipeName + "-worker";
|
|
9
|
+
}
|
|
10
|
+
exports.getWorkerPipeName = getWorkerPipeName;
|
|
11
|
+
//# sourceMappingURL=conout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conout.js","sourceRoot":"","sources":["../../src/shared/conout.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAUH,SAAgB,iBAAiB,CAAC,cAAsB;IACtD,OAAU,cAAc,YAAS,CAAC;AACpC,CAAC;AAFD,8CAEC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2012-2015, Christopher Jeffrey (MIT License)
|
|
4
|
+
* Copyright (c) 2016, Daniel Imms (MIT License).
|
|
5
|
+
* Copyright (c) 2018, Microsoft Corporation (MIT License).
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.Terminal = exports.DEFAULT_ROWS = exports.DEFAULT_COLS = void 0;
|
|
9
|
+
var events_1 = require("events");
|
|
10
|
+
var eventEmitter2_1 = require("./eventEmitter2");
|
|
11
|
+
exports.DEFAULT_COLS = 80;
|
|
12
|
+
exports.DEFAULT_ROWS = 24;
|
|
13
|
+
/**
|
|
14
|
+
* Default messages to indicate PAUSE/RESUME for automatic flow control.
|
|
15
|
+
* To avoid conflicts with rebound XON/XOFF control codes (such as on-my-zsh),
|
|
16
|
+
* the sequences can be customized in `IPtyForkOptions`.
|
|
17
|
+
*/
|
|
18
|
+
var FLOW_CONTROL_PAUSE = '\x13'; // defaults to XOFF
|
|
19
|
+
var FLOW_CONTROL_RESUME = '\x11'; // defaults to XON
|
|
20
|
+
var Terminal = /** @class */ (function () {
|
|
21
|
+
function Terminal(opt) {
|
|
22
|
+
this._pid = 0;
|
|
23
|
+
this._fd = 0;
|
|
24
|
+
this._cols = 0;
|
|
25
|
+
this._rows = 0;
|
|
26
|
+
this._readable = false;
|
|
27
|
+
this._writable = false;
|
|
28
|
+
this._onData = new eventEmitter2_1.EventEmitter2();
|
|
29
|
+
this._onExit = new eventEmitter2_1.EventEmitter2();
|
|
30
|
+
// for 'close'
|
|
31
|
+
this._internalee = new events_1.EventEmitter();
|
|
32
|
+
// setup flow control handling
|
|
33
|
+
this.handleFlowControl = !!(opt === null || opt === void 0 ? void 0 : opt.handleFlowControl);
|
|
34
|
+
this._flowControlPause = (opt === null || opt === void 0 ? void 0 : opt.flowControlPause) || FLOW_CONTROL_PAUSE;
|
|
35
|
+
this._flowControlResume = (opt === null || opt === void 0 ? void 0 : opt.flowControlResume) || FLOW_CONTROL_RESUME;
|
|
36
|
+
if (!opt) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
// Do basic type checks here in case node-pty is being used within JavaScript. If the wrong
|
|
40
|
+
// types go through to the C++ side it can lead to hard to diagnose exceptions.
|
|
41
|
+
this._checkType('name', opt.name ? opt.name : undefined, 'string');
|
|
42
|
+
this._checkType('cols', opt.cols ? opt.cols : undefined, 'number');
|
|
43
|
+
this._checkType('rows', opt.rows ? opt.rows : undefined, 'number');
|
|
44
|
+
this._checkType('cwd', opt.cwd ? opt.cwd : undefined, 'string');
|
|
45
|
+
this._checkType('env', opt.env ? opt.env : undefined, 'object');
|
|
46
|
+
this._checkType('uid', opt.uid ? opt.uid : undefined, 'number');
|
|
47
|
+
this._checkType('gid', opt.gid ? opt.gid : undefined, 'number');
|
|
48
|
+
this._checkType('encoding', opt.encoding ? opt.encoding : undefined, 'string');
|
|
49
|
+
}
|
|
50
|
+
Object.defineProperty(Terminal.prototype, "onData", {
|
|
51
|
+
get: function () { return this._onData.event; },
|
|
52
|
+
enumerable: false,
|
|
53
|
+
configurable: true
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(Terminal.prototype, "onExit", {
|
|
56
|
+
get: function () { return this._onExit.event; },
|
|
57
|
+
enumerable: false,
|
|
58
|
+
configurable: true
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(Terminal.prototype, "pid", {
|
|
61
|
+
get: function () { return this._pid; },
|
|
62
|
+
enumerable: false,
|
|
63
|
+
configurable: true
|
|
64
|
+
});
|
|
65
|
+
Object.defineProperty(Terminal.prototype, "cols", {
|
|
66
|
+
get: function () { return this._cols; },
|
|
67
|
+
enumerable: false,
|
|
68
|
+
configurable: true
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(Terminal.prototype, "rows", {
|
|
71
|
+
get: function () { return this._rows; },
|
|
72
|
+
enumerable: false,
|
|
73
|
+
configurable: true
|
|
74
|
+
});
|
|
75
|
+
Terminal.prototype.write = function (data) {
|
|
76
|
+
if (this.handleFlowControl) {
|
|
77
|
+
// PAUSE/RESUME messages are not forwarded to the pty
|
|
78
|
+
if (data === this._flowControlPause) {
|
|
79
|
+
this.pause();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (data === this._flowControlResume) {
|
|
83
|
+
this.resume();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// everything else goes to the real pty
|
|
88
|
+
this._write(data);
|
|
89
|
+
};
|
|
90
|
+
Terminal.prototype._forwardEvents = function () {
|
|
91
|
+
var _this = this;
|
|
92
|
+
this.on('data', function (e) { return _this._onData.fire(e); });
|
|
93
|
+
this.on('exit', function (exitCode, signal) { return _this._onExit.fire({ exitCode: exitCode, signal: signal }); });
|
|
94
|
+
};
|
|
95
|
+
Terminal.prototype._checkType = function (name, value, type, allowArray) {
|
|
96
|
+
if (allowArray === void 0) { allowArray = false; }
|
|
97
|
+
if (value === undefined) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (allowArray) {
|
|
101
|
+
if (Array.isArray(value)) {
|
|
102
|
+
value.forEach(function (v, i) {
|
|
103
|
+
if (typeof v !== type) {
|
|
104
|
+
throw new Error(name + "[" + i + "] must be a " + type + " (not a " + typeof v[i] + ")");
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (typeof value !== type) {
|
|
111
|
+
throw new Error(name + " must be a " + type + " (not a " + typeof value + ")");
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
/** See net.Socket.end */
|
|
115
|
+
Terminal.prototype.end = function (data) {
|
|
116
|
+
this._socket.end(data);
|
|
117
|
+
};
|
|
118
|
+
/** See stream.Readable.pipe */
|
|
119
|
+
Terminal.prototype.pipe = function (dest, options) {
|
|
120
|
+
return this._socket.pipe(dest, options);
|
|
121
|
+
};
|
|
122
|
+
/** See net.Socket.pause */
|
|
123
|
+
Terminal.prototype.pause = function () {
|
|
124
|
+
return this._socket.pause();
|
|
125
|
+
};
|
|
126
|
+
/** See net.Socket.resume */
|
|
127
|
+
Terminal.prototype.resume = function () {
|
|
128
|
+
return this._socket.resume();
|
|
129
|
+
};
|
|
130
|
+
/** See net.Socket.setEncoding */
|
|
131
|
+
Terminal.prototype.setEncoding = function (encoding) {
|
|
132
|
+
if (this._socket._decoder) {
|
|
133
|
+
delete this._socket._decoder;
|
|
134
|
+
}
|
|
135
|
+
if (encoding) {
|
|
136
|
+
this._socket.setEncoding(encoding);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
Terminal.prototype.addListener = function (eventName, listener) { this.on(eventName, listener); };
|
|
140
|
+
Terminal.prototype.on = function (eventName, listener) {
|
|
141
|
+
if (eventName === 'close') {
|
|
142
|
+
this._internalee.on('close', listener);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
this._socket.on(eventName, listener);
|
|
146
|
+
};
|
|
147
|
+
Terminal.prototype.emit = function (eventName) {
|
|
148
|
+
var args = [];
|
|
149
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
150
|
+
args[_i - 1] = arguments[_i];
|
|
151
|
+
}
|
|
152
|
+
if (eventName === 'close') {
|
|
153
|
+
return this._internalee.emit.apply(this._internalee, arguments);
|
|
154
|
+
}
|
|
155
|
+
return this._socket.emit.apply(this._socket, arguments);
|
|
156
|
+
};
|
|
157
|
+
Terminal.prototype.listeners = function (eventName) {
|
|
158
|
+
return this._socket.listeners(eventName);
|
|
159
|
+
};
|
|
160
|
+
Terminal.prototype.removeListener = function (eventName, listener) {
|
|
161
|
+
this._socket.removeListener(eventName, listener);
|
|
162
|
+
};
|
|
163
|
+
Terminal.prototype.removeAllListeners = function (eventName) {
|
|
164
|
+
this._socket.removeAllListeners(eventName);
|
|
165
|
+
};
|
|
166
|
+
Terminal.prototype.once = function (eventName, listener) {
|
|
167
|
+
this._socket.once(eventName, listener);
|
|
168
|
+
};
|
|
169
|
+
Terminal.prototype._close = function () {
|
|
170
|
+
this._socket.readable = false;
|
|
171
|
+
this.write = function () { };
|
|
172
|
+
this.end = function () { };
|
|
173
|
+
this._writable = false;
|
|
174
|
+
this._readable = false;
|
|
175
|
+
};
|
|
176
|
+
Terminal.prototype._parseEnv = function (env) {
|
|
177
|
+
var keys = Object.keys(env || {});
|
|
178
|
+
var pairs = [];
|
|
179
|
+
for (var i = 0; i < keys.length; i++) {
|
|
180
|
+
if (keys[i] === undefined) {
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
pairs.push(keys[i] + '=' + env[keys[i]]);
|
|
184
|
+
}
|
|
185
|
+
return pairs;
|
|
186
|
+
};
|
|
187
|
+
return Terminal;
|
|
188
|
+
}());
|
|
189
|
+
exports.Terminal = Terminal;
|
|
190
|
+
//# sourceMappingURL=terminal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal.js","sourceRoot":"","sources":["../src/terminal.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,iCAAsC;AAEtC,iDAAwD;AAG3C,QAAA,YAAY,GAAW,EAAE,CAAC;AAC1B,QAAA,YAAY,GAAW,EAAE,CAAC;AAEvC;;;;GAIG;AACH,IAAM,kBAAkB,GAAI,MAAM,CAAC,CAAG,mBAAmB;AACzD,IAAM,mBAAmB,GAAG,MAAM,CAAC,CAAG,kBAAkB;AAExD;IA4BE,kBAAY,GAAqB;QA1BvB,SAAI,GAAW,CAAC,CAAC;QACjB,QAAG,GAAW,CAAC,CAAC;QAKhB,UAAK,GAAW,CAAC,CAAC;QAClB,UAAK,GAAW,CAAC,CAAC;QAElB,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