node-pty 1.2.0-beta.7 → 1.2.0-beta.8

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.
Files changed (66) hide show
  1. package/binding.gyp +20 -18
  2. package/package.json +6 -5
  3. package/prebuilds/darwin-arm64/pty.node +0 -0
  4. package/prebuilds/darwin-arm64/spawn-helper +0 -0
  5. package/prebuilds/darwin-x64/pty.node +0 -0
  6. package/prebuilds/darwin-x64/spawn-helper +0 -0
  7. package/prebuilds/win32-arm64/conpty.node +0 -0
  8. package/prebuilds/win32-arm64/conpty.pdb +0 -0
  9. package/prebuilds/win32-arm64/conpty_console_list.node +0 -0
  10. package/prebuilds/win32-arm64/conpty_console_list.pdb +0 -0
  11. package/prebuilds/win32-x64/conpty.node +0 -0
  12. package/prebuilds/win32-x64/conpty.pdb +0 -0
  13. package/prebuilds/win32-x64/conpty_console_list.node +0 -0
  14. package/prebuilds/win32-x64/conpty_console_list.pdb +0 -0
  15. package/deps/.editorconfig +0 -2
  16. package/lib/conpty_console_list_agent.js.map +0 -1
  17. package/lib/eventEmitter2.js.map +0 -1
  18. package/lib/eventEmitter2.test.js +0 -30
  19. package/lib/eventEmitter2.test.js.map +0 -1
  20. package/lib/index.js.map +0 -1
  21. package/lib/interfaces.js.map +0 -1
  22. package/lib/shared/conout.js.map +0 -1
  23. package/lib/terminal.js.map +0 -1
  24. package/lib/terminal.test.js +0 -139
  25. package/lib/terminal.test.js.map +0 -1
  26. package/lib/testUtils.test.js +0 -28
  27. package/lib/testUtils.test.js.map +0 -1
  28. package/lib/types.js.map +0 -1
  29. package/lib/unixTerminal.js.map +0 -1
  30. package/lib/unixTerminal.test.js +0 -383
  31. package/lib/unixTerminal.test.js.map +0 -1
  32. package/lib/utils.js.map +0 -1
  33. package/lib/windowsConoutConnection.js.map +0 -1
  34. package/lib/windowsPtyAgent.js.map +0 -1
  35. package/lib/windowsPtyAgent.test.js +0 -90
  36. package/lib/windowsPtyAgent.test.js.map +0 -1
  37. package/lib/windowsTerminal.js.map +0 -1
  38. package/lib/windowsTerminal.test.js +0 -218
  39. package/lib/windowsTerminal.test.js.map +0 -1
  40. package/lib/worker/conoutSocketWorker.js.map +0 -1
  41. package/scripts/gen-compile-commands.js +0 -8
  42. package/scripts/increment-version.js +0 -54
  43. package/scripts/linux/checksums.txt +0 -2
  44. package/scripts/linux/install-sysroot.js +0 -158
  45. package/scripts/linux/verify-glibc-requirements.sh +0 -36
  46. package/src/conpty_console_list_agent.ts +0 -15
  47. package/src/eventEmitter2.test.ts +0 -30
  48. package/src/eventEmitter2.ts +0 -48
  49. package/src/index.ts +0 -52
  50. package/src/interfaces.ts +0 -138
  51. package/src/native.d.ts +0 -37
  52. package/src/shared/conout.ts +0 -15
  53. package/src/terminal.test.ts +0 -119
  54. package/src/terminal.ts +0 -211
  55. package/src/testUtils.test.ts +0 -23
  56. package/src/tsconfig.json +0 -22
  57. package/src/types.ts +0 -15
  58. package/src/unixTerminal.test.ts +0 -402
  59. package/src/unixTerminal.ts +0 -388
  60. package/src/utils.ts +0 -29
  61. package/src/windowsConoutConnection.ts +0 -82
  62. package/src/windowsPtyAgent.test.ts +0 -94
  63. package/src/windowsPtyAgent.ts +0 -261
  64. package/src/windowsTerminal.test.ts +0 -229
  65. package/src/windowsTerminal.ts +0 -203
  66. package/src/worker/conoutSocketWorker.ts +0 -22
@@ -1,218 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) 2017, Daniel Imms (MIT License).
4
- * Copyright (c) 2018, Microsoft Corporation (MIT License).
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- var fs = require("fs");
8
- var assert = require("assert");
9
- var windowsTerminal_1 = require("./windowsTerminal");
10
- var path = require("path");
11
- var psList = require("ps-list");
12
- function pollForProcessState(desiredState, intervalMs, timeoutMs) {
13
- if (intervalMs === void 0) { intervalMs = 100; }
14
- if (timeoutMs === void 0) { timeoutMs = 2000; }
15
- return new Promise(function (resolve) {
16
- var tries = 0;
17
- var interval = setInterval(function () {
18
- psList({ all: true }).then(function (ps) {
19
- var success = true;
20
- var pids = Object.keys(desiredState).map(function (k) { return parseInt(k, 10); });
21
- console.log('expected pids', JSON.stringify(pids));
22
- pids.forEach(function (pid) {
23
- if (desiredState[pid]) {
24
- if (!ps.some(function (p) { return p.pid === pid; })) {
25
- console.log("pid " + pid + " does not exist");
26
- success = false;
27
- }
28
- }
29
- else {
30
- if (ps.some(function (p) { return p.pid === pid; })) {
31
- console.log("pid " + pid + " still exists");
32
- success = false;
33
- }
34
- }
35
- });
36
- if (success) {
37
- clearInterval(interval);
38
- resolve();
39
- return;
40
- }
41
- tries++;
42
- if (tries * intervalMs >= timeoutMs) {
43
- clearInterval(interval);
44
- var processListing = pids.map(function (k) { return k + ": " + desiredState[k]; }).join('\n');
45
- assert.fail("Bad process state, expected:\n" + processListing);
46
- resolve();
47
- }
48
- });
49
- }, intervalMs);
50
- });
51
- }
52
- function pollForProcessTreeSize(pid, size, intervalMs, timeoutMs) {
53
- if (intervalMs === void 0) { intervalMs = 100; }
54
- if (timeoutMs === void 0) { timeoutMs = 2000; }
55
- return new Promise(function (resolve) {
56
- var tries = 0;
57
- var interval = setInterval(function () {
58
- psList({ all: true }).then(function (ps) {
59
- var openList = [];
60
- openList.push(ps.filter(function (p) { return p.pid === pid; }).map(function (p) {
61
- return { name: p.name, pid: p.pid };
62
- })[0]);
63
- var list = [];
64
- var _loop_1 = function () {
65
- var current = openList.shift();
66
- ps.filter(function (p) { return p.ppid === current.pid; }).map(function (p) {
67
- return { name: p.name, pid: p.pid };
68
- }).forEach(function (p) { return openList.push(p); });
69
- list.push(current);
70
- };
71
- while (openList.length) {
72
- _loop_1();
73
- }
74
- console.log('list', JSON.stringify(list));
75
- var success = list.length === size;
76
- if (success) {
77
- clearInterval(interval);
78
- resolve(list);
79
- return;
80
- }
81
- tries++;
82
- if (tries * intervalMs >= timeoutMs) {
83
- clearInterval(interval);
84
- assert.fail("Bad process state, expected: " + size + ", actual: " + list.length);
85
- }
86
- });
87
- }, intervalMs);
88
- });
89
- }
90
- if (process.platform === 'win32') {
91
- [false, true].forEach(function (useConptyDll) {
92
- describe("WindowsTerminal (useConptyDll = " + useConptyDll + ")", function () {
93
- describe('kill', function () {
94
- it('should not crash parent process', function (done) {
95
- this.timeout(20000);
96
- var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], { useConptyDll: useConptyDll });
97
- term.on('exit', function () { return done(); });
98
- term.kill();
99
- });
100
- it('should kill the process tree', function (done) {
101
- this.timeout(20000);
102
- var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], { useConptyDll: useConptyDll });
103
- // Start sub-processes
104
- term.write('powershell.exe\r');
105
- term.write('node.exe\r');
106
- console.log('start poll for tree size');
107
- pollForProcessTreeSize(term.pid, 3, 500, 5000).then(function (list) {
108
- assert.strictEqual(list[0].name.toLowerCase(), 'cmd.exe');
109
- assert.strictEqual(list[1].name.toLowerCase(), 'powershell.exe');
110
- assert.strictEqual(list[2].name.toLowerCase(), 'node.exe');
111
- term.kill();
112
- var desiredState = {};
113
- desiredState[list[0].pid] = false;
114
- desiredState[list[1].pid] = false;
115
- desiredState[list[2].pid] = false;
116
- term.on('exit', function () {
117
- pollForProcessState(desiredState, 1000, 5000).then(function () {
118
- done();
119
- }).catch(done);
120
- });
121
- }).catch(done);
122
- });
123
- });
124
- describe('resize', function () {
125
- it('should throw a non-native exception when resizing an invalid value', function (done) {
126
- this.timeout(20000);
127
- var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], { useConptyDll: useConptyDll });
128
- assert.throws(function () { return term.resize(-1, -1); });
129
- assert.throws(function () { return term.resize(0, 0); });
130
- assert.doesNotThrow(function () { return term.resize(1, 1); });
131
- term.on('exit', function () {
132
- done();
133
- });
134
- term.kill();
135
- });
136
- it('should throw a non-native exception when resizing a killed terminal', function (done) {
137
- this.timeout(20000);
138
- var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], { useConptyDll: useConptyDll });
139
- term._defer(function () {
140
- term.once('exit', function () {
141
- assert.throws(function () { return term.resize(1, 1); });
142
- done();
143
- });
144
- term.destroy();
145
- });
146
- });
147
- });
148
- describe('Args as CommandLine', function () {
149
- it('should not fail running a file containing a space in the path', function (done) {
150
- this.timeout(10000);
151
- var spaceFolder = path.resolve(__dirname, '..', 'fixtures', 'space folder');
152
- if (!fs.existsSync(spaceFolder)) {
153
- fs.mkdirSync(spaceFolder);
154
- }
155
- var cmdCopiedPath = path.resolve(spaceFolder, 'cmd.exe');
156
- var data = fs.readFileSync(process.env.windir + "\\System32\\cmd.exe");
157
- fs.writeFileSync(cmdCopiedPath, data);
158
- if (!fs.existsSync(cmdCopiedPath)) {
159
- // Skip test if git bash isn't installed
160
- return;
161
- }
162
- var term = new windowsTerminal_1.WindowsTerminal(cmdCopiedPath, '/c echo "hello world"', { useConptyDll: useConptyDll });
163
- var result = '';
164
- term.on('data', function (data) {
165
- result += data;
166
- });
167
- term.on('exit', function () {
168
- assert.ok(result.indexOf('hello world') >= 1);
169
- done();
170
- });
171
- });
172
- });
173
- describe('env', function () {
174
- it('should set environment variables of the shell', function (done) {
175
- this.timeout(10000);
176
- var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '/C echo %FOO%', { useConptyDll: useConptyDll, env: { FOO: 'BAR' } });
177
- var result = '';
178
- term.on('data', function (data) {
179
- result += data;
180
- });
181
- term.on('exit', function () {
182
- assert.ok(result.indexOf('BAR') >= 0);
183
- done();
184
- });
185
- });
186
- });
187
- describe('On close', function () {
188
- it('should return process zero exit codes', function (done) {
189
- this.timeout(10000);
190
- var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '/C exit', { useConptyDll: useConptyDll });
191
- term.on('exit', function (code) {
192
- assert.strictEqual(code, 0);
193
- done();
194
- });
195
- });
196
- it('should return process non-zero exit codes', function (done) {
197
- this.timeout(10000);
198
- var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '/C exit 2', { useConptyDll: useConptyDll });
199
- term.on('exit', function (code) {
200
- assert.strictEqual(code, 2);
201
- done();
202
- });
203
- });
204
- });
205
- describe('Write', function () {
206
- it('should accept input', function (done) {
207
- this.timeout(10000);
208
- var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '', { useConptyDll: useConptyDll });
209
- term.write('exit\r');
210
- term.on('exit', function () {
211
- done();
212
- });
213
- });
214
- });
215
- });
216
- });
217
- }
218
- //# sourceMappingURL=windowsTerminal.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"windowsTerminal.test.js","sourceRoot":"","sources":["../src/windowsTerminal.test.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,uBAAyB;AACzB,+BAAiC;AACjC,qDAAoD;AACpD,2BAA6B;AAC7B,gCAAkC;AAYlC,SAAS,mBAAmB,CAAC,YAA2B,EAAE,UAAwB,EAAE,SAAwB;IAAlD,2BAAA,EAAA,gBAAwB;IAAE,0BAAA,EAAA,gBAAwB;IAC1G,OAAO,IAAI,OAAO,CAAO,UAAA,OAAO;QAC9B,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAM,QAAQ,GAAG,WAAW,CAAC;YAC3B,MAAM,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,UAAA,EAAE;gBAC3B,IAAI,OAAO,GAAG,IAAI,CAAC;gBACnB,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,EAAf,CAAe,CAAC,CAAC;gBACjE,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;gBACnD,IAAI,CAAC,OAAO,CAAC,UAAA,GAAG;oBACd,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE;wBACrB,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CA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ACD,2BAAU,CAAC,WAAW,eAA2B,CAAC;AACpD,CAAC,CAAC,CAAC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * Copyright (c) 2025, Microsoft Corporation (MIT License).
3
- */
4
-
5
- const { execSync } = require('child_process');
6
-
7
- console.log(`\x1b[32m> Generating compile_commands.json...\x1b[0m`);
8
- execSync('npx --offline node-gyp configure -- -f compile_commands_json');
@@ -1,54 +0,0 @@
1
- /**
2
- * Copyright (c) 2019, Microsoft Corporation (MIT License).
3
- */
4
-
5
- const cp = require('child_process');
6
- const fs = require('fs');
7
- const path = require('path');
8
- const packageJson = require('../package.json');
9
-
10
- // Determine if this is a stable or beta release
11
- const publishedVersions = getPublishedVersions();
12
- const isStableRelease = !publishedVersions.includes(packageJson.version);
13
-
14
- // Get the next version
15
- const nextVersion = isStableRelease ? packageJson.version : getNextBetaVersion();
16
- console.log(`Setting version to ${nextVersion}`);
17
-
18
- // Set the version in package.json
19
- const packageJsonFile = path.resolve(__dirname, '..', 'package.json');
20
- packageJson.version = nextVersion;
21
- fs.writeFileSync(packageJsonFile, JSON.stringify(packageJson, null, 2));
22
-
23
- function getNextBetaVersion() {
24
- if (!/^[0-9]+\.[0-9]+\.[0-9]+$/.exec(packageJson.version)) {
25
- console.error('The package.json version must be of the form x.y.z');
26
- process.exit(1);
27
- }
28
- const tag = 'beta';
29
- const stableVersion = packageJson.version.split('.');
30
- const nextStableVersion = `${stableVersion[0]}.${parseInt(stableVersion[1]) + 1}.0`;
31
- const publishedVersions = getPublishedVersions(nextStableVersion, tag);
32
- if (publishedVersions.length === 0) {
33
- return `${nextStableVersion}-${tag}.1`;
34
- }
35
- const latestPublishedVersion = publishedVersions.sort((a, b) => {
36
- const aVersion = parseInt(a.substr(a.search(/[0-9]+$/)));
37
- const bVersion = parseInt(b.substr(b.search(/[0-9]+$/)));
38
- return aVersion > bVersion ? -1 : 1;
39
- })[0];
40
- const latestTagVersion = parseInt(latestPublishedVersion.substr(latestPublishedVersion.search(/[0-9]+$/)), 10);
41
- return `${nextStableVersion}-${tag}.${latestTagVersion + 1}`;
42
- }
43
-
44
- function getPublishedVersions(version, tag) {
45
- const isWin32 = process.platform === 'win32';
46
- const versionsProcess = isWin32 ?
47
- cp.spawnSync('npm.cmd', ['view', packageJson.name, 'versions', '--json'], { shell: true }) :
48
- cp.spawnSync('npm', ['view', packageJson.name, 'versions', '--json']);
49
- const versionsJson = JSON.parse(versionsProcess.stdout);
50
- if (tag) {
51
- return versionsJson.filter(v => !v.search(new RegExp(`${version}-${tag}\.[0-9]+`)));
52
- }
53
- return versionsJson;
54
- }
@@ -1,2 +0,0 @@
1
- 3122af49c493c5c767c2b0772a41119cbdc9803125a705683445b4066dc88b82 x86_64-linux-gnu-glibc-2.28-gcc-10.5.0.tar.gz
2
- 3baac81a39b69e0929e4700f4f78f022adefc515010054ec393565657c4fff32 aarch64-linux-gnu-glibc-2.28-gcc-10.5.0.tar.gz
@@ -1,158 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
-
6
- const { execSync } = require('child_process');
7
- const { tmpdir } = require('os');
8
- const fs = require('fs');
9
- const path = require('path');
10
- const { createHash } = require('crypto');
11
-
12
- const REPO_ROOT = path.join(__dirname, '..', '..');
13
-
14
- const ghApiHeaders = {
15
- Accept: 'application/vnd.github.v3+json',
16
- 'User-Agent': 'node-pty Build',
17
- };
18
-
19
- if (process.env.GITHUB_TOKEN) {
20
- ghApiHeaders.Authorization = 'Basic ' + Buffer.from(process.env.GITHUB_TOKEN).toString('base64');
21
- console.error('Using GITHUB_TOKEN for authenticated requests to GitHub API.');
22
- }
23
-
24
- const ghDownloadHeaders = {
25
- ...ghApiHeaders,
26
- Accept: 'application/octet-stream',
27
- };
28
-
29
- function getSysrootChecksum(expectedName) {
30
- const checksumPath = path.join(REPO_ROOT, 'scripts', 'linux', 'checksums.txt');
31
- const checksums = fs.readFileSync(checksumPath, 'utf8');
32
- for (const line of checksums.split('\n')) {
33
- const [checksum, name] = line.split(/\s+/);
34
- if (name === expectedName) {
35
- return checksum;
36
- }
37
- }
38
- return undefined;
39
- }
40
-
41
- async function fetchUrl(options, retries = 10, retryDelay = 1000) {
42
- try {
43
- const controller = new AbortController();
44
- const timeout = setTimeout(() => controller.abort(), 30 * 1000);
45
- const version = '20250407-330404';
46
- try {
47
- const response = await fetch(`https://api.github.com/repos/Microsoft/vscode-linux-build-agent/releases/tags/v${version}`, {
48
- headers: ghApiHeaders,
49
- signal: controller.signal
50
- });
51
- if (response.ok && (response.status >= 200 && response.status < 300)) {
52
- console.error(`Fetch completed: Status ${response.status}.`);
53
- const contents = Buffer.from(await response.arrayBuffer());
54
- const asset = JSON.parse(contents.toString()).assets.find((a) => a.name === options.assetName);
55
- if (!asset) {
56
- throw new Error(`Could not find asset in release of Microsoft/vscode-linux-build-agent @ ${version}`);
57
- }
58
- console.error(`Found asset ${options.assetName} @ ${asset.url}.`);
59
- const assetResponse = await fetch(asset.url, {
60
- headers: ghDownloadHeaders
61
- });
62
- if (assetResponse.ok && (assetResponse.status >= 200 && assetResponse.status < 300)) {
63
- const assetContents = Buffer.from(await assetResponse.arrayBuffer());
64
- console.error(`Fetched response body buffer: ${assetContents.byteLength} bytes`);
65
- if (options.checksumSha256) {
66
- const actualSHA256Checksum = createHash('sha256').update(assetContents).digest('hex');
67
- if (actualSHA256Checksum !== options.checksumSha256) {
68
- throw new Error(`Checksum mismatch for ${asset.url} (expected ${options.checksumSha256}, actual ${actualSHA256Checksum})`);
69
- }
70
- }
71
- console.error(`Verified SHA256 checksums match for ${asset.url}`);
72
- const tarCommand = `tar -xz -C ${options.dest}`;
73
- execSync(tarCommand, { input: assetContents });
74
- console.error(`Fetch complete!`);
75
- return;
76
- }
77
- throw new Error(`Request ${asset.url} failed with status code: ${assetResponse.status}`);
78
- }
79
- throw new Error(`Request https://api.github.com failed with status code: ${response.status}`);
80
- } finally {
81
- clearTimeout(timeout);
82
- }
83
- } catch (e) {
84
- if (retries > 0) {
85
- console.error(`Fetching failed: ${e}`);
86
- await new Promise(resolve => setTimeout(resolve, retryDelay));
87
- return fetchUrl(options, retries - 1, retryDelay);
88
- }
89
- throw e;
90
- }
91
- }
92
-
93
- async function getSysroot(arch) {
94
- let expectedName;
95
- let triple;
96
- const prefix = '-glibc-2.28-gcc-10.5.0';
97
-
98
- switch (arch) {
99
- case 'x64':
100
- expectedName = `x86_64-linux-gnu${prefix}.tar.gz`;
101
- triple = 'x86_64-linux-gnu';
102
- break;
103
- case 'arm64':
104
- expectedName = `aarch64-linux-gnu${prefix}.tar.gz`;
105
- triple = 'aarch64-linux-gnu';
106
- break;
107
- default:
108
- throw new Error(`Unsupported architecture: ${arch}`);
109
- }
110
-
111
- console.log(`Fetching ${expectedName} for ${triple}`);
112
- const checksumSha256 = getSysrootChecksum(expectedName);
113
- if (!checksumSha256) {
114
- throw new Error(`Could not find checksum for ${expectedName}`);
115
- }
116
-
117
- const sysroot = path.join(tmpdir(), `vscode-${arch}-sysroot`);
118
- const stamp = path.join(sysroot, '.stamp');
119
- const result = `${sysroot}/${triple}/${triple}/sysroot`;
120
-
121
- if (fs.existsSync(stamp) && fs.readFileSync(stamp).toString() === expectedName) {
122
- console.log(`Sysroot already installed: ${result}`);
123
- return result;
124
- }
125
-
126
- console.error(`Installing ${arch} root image: ${sysroot}`);
127
- fs.rmSync(sysroot, { recursive: true, force: true });
128
- fs.mkdirSync(sysroot, { recursive: true });
129
-
130
- await fetchUrl({
131
- checksumSha256,
132
- assetName: expectedName,
133
- dest: sysroot
134
- });
135
-
136
- fs.writeFileSync(stamp, expectedName);
137
- console.log(`Sysroot installed: ${result}`);
138
- return result;
139
- }
140
-
141
- async function main() {
142
- const arch = process.argv[2] || process.env.ARCH || 'x64';
143
- console.error(`Installing sysroot for architecture: ${arch}`);
144
-
145
- try {
146
- const sysrootPath = await getSysroot(arch);
147
- console.log(`SYSROOT_PATH=${sysrootPath}`);
148
- } catch (error) {
149
- console.error('Error installing sysroot:', error);
150
- process.exit(1);
151
- }
152
- }
153
-
154
- if (require.main === module) {
155
- main();
156
- }
157
-
158
- module.exports = { getSysroot };
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -e
4
-
5
- # Get all files with .node extension from given folder
6
- files=$(find $SEARCH_PATH -name "*.node")
7
-
8
- echo "Verifying requirements for files: $files"
9
-
10
- for file in $files; do
11
- glibc_version="$EXPECTED_GLIBC_VERSION"
12
- glibcxx_version="$EXPECTED_GLIBCXX_VERSION"
13
- while IFS= read -r line; do
14
- if [[ $line == *"GLIBC_"* ]]; then
15
- version=$(echo "$line" | awk '{if ($5 ~ /^[0-9a-fA-F]+$/) print $6; else print $5}' | tr -d '()')
16
- version=${version#*_}
17
- if [[ $(printf "%s\n%s" "$version" "$glibc_version" | sort -V | tail -n1) == "$version" ]]; then
18
- glibc_version=$version
19
- fi
20
- elif [[ $line == *"GLIBCXX_"* ]]; then
21
- version=$(echo "$line" | awk '{if ($5 ~ /^[0-9a-fA-F]+$/) print $6; else print $5}' | tr -d '()')
22
- version=${version#*_}
23
- if [[ $(printf "%s\n%s" "$version" "$glibcxx_version" | sort -V | tail -n1) == "$version" ]]; then
24
- glibcxx_version=$version
25
- fi
26
- fi
27
- done < <(objdump -T "$file")
28
-
29
- if [[ "$glibc_version" != "$EXPECTED_GLIBC_VERSION" ]]; then
30
- echo "Error: File $file has dependency on GLIBC > $EXPECTED_GLIBC_VERSION, found $glibc_version"
31
- exit 1
32
- fi
33
- if [[ "$glibcxx_version" != "$EXPECTED_GLIBCXX_VERSION" ]]; then
34
- echo "Error: File $file has dependency on GLIBCXX > $EXPECTED_GLIBCXX_VERSION, found $glibcxx_version"
35
- fi
36
- done
@@ -1,15 +0,0 @@
1
- /**
2
- * Copyright (c) 2019, Microsoft Corporation (MIT License).
3
- *
4
- * This module fetches the console process list for a particular PID. It must be
5
- * called from a different process (child_process.fork) as there can only be a
6
- * single console attached to a process.
7
- */
8
-
9
- import { loadNativeModule } from './utils';
10
-
11
- const getConsoleProcessList = loadNativeModule('conpty_console_list').module.getConsoleProcessList;
12
- const shellPid = parseInt(process.argv[2], 10);
13
- const consoleProcessList = getConsoleProcessList(shellPid);
14
- process.send!({ consoleProcessList });
15
- process.exit(0);
@@ -1,30 +0,0 @@
1
- /**
2
- * Copyright (c) 2019, Microsoft Corporation (MIT License).
3
- */
4
-
5
- import * as assert from 'assert';
6
- import { EventEmitter2 } from './eventEmitter2';
7
-
8
- describe('EventEmitter2', () => {
9
- it('should fire listeners multiple times', () => {
10
- const order: string[] = [];
11
- const emitter = new EventEmitter2<number>();
12
- emitter.event(data => order.push(data + 'a'));
13
- emitter.event(data => order.push(data + 'b'));
14
- emitter.fire(1);
15
- emitter.fire(2);
16
- assert.deepEqual(order, [ '1a', '1b', '2a', '2b' ]);
17
- });
18
-
19
- it('should not fire listeners once disposed', () => {
20
- const order: string[] = [];
21
- const emitter = new EventEmitter2<number>();
22
- emitter.event(data => order.push(data + 'a'));
23
- const disposeB = emitter.event(data => order.push(data + 'b'));
24
- emitter.event(data => order.push(data + 'c'));
25
- emitter.fire(1);
26
- disposeB.dispose();
27
- emitter.fire(2);
28
- assert.deepEqual(order, [ '1a', '1b', '1c', '2a', '2c' ]);
29
- });
30
- });
@@ -1,48 +0,0 @@
1
- /**
2
- * Copyright (c) 2019, Microsoft Corporation (MIT License).
3
- */
4
-
5
- import { IDisposable } from './types';
6
-
7
- interface IListener<T> {
8
- (e: T): void;
9
- }
10
-
11
- export interface IEvent<T> {
12
- (listener: (e: T) => any): IDisposable;
13
- }
14
-
15
- export class EventEmitter2<T> {
16
- private _listeners: IListener<T>[] = [];
17
- private _event?: IEvent<T>;
18
-
19
- public get event(): IEvent<T> {
20
- if (!this._event) {
21
- this._event = (listener: (e: T) => any) => {
22
- this._listeners.push(listener);
23
- const disposable = {
24
- dispose: () => {
25
- for (let i = 0; i < this._listeners.length; i++) {
26
- if (this._listeners[i] === listener) {
27
- this._listeners.splice(i, 1);
28
- return;
29
- }
30
- }
31
- }
32
- };
33
- return disposable;
34
- };
35
- }
36
- return this._event;
37
- }
38
-
39
- public fire(data: T): void {
40
- const queue: IListener<T>[] = [];
41
- for (let i = 0; i < this._listeners.length; i++) {
42
- queue.push(this._listeners[i]);
43
- }
44
- for (let i = 0; i < queue.length; i++) {
45
- queue[i].call(undefined, data);
46
- }
47
- }
48
- }
package/src/index.ts DELETED
@@ -1,52 +0,0 @@
1
- /**
2
- * Copyright (c) 2012-2015, Christopher Jeffrey, Peter Sunde (MIT License)
3
- * Copyright (c) 2016, Daniel Imms (MIT License).
4
- * Copyright (c) 2018, Microsoft Corporation (MIT License).
5
- */
6
-
7
- import { ITerminal, IPtyOpenOptions, IPtyForkOptions, IWindowsPtyForkOptions } from './interfaces';
8
- import { ArgvOrCommandLine } from './types';
9
- import { loadNativeModule } from './utils';
10
-
11
- let terminalCtor: any;
12
- if (process.platform === 'win32') {
13
- terminalCtor = require('./windowsTerminal').WindowsTerminal;
14
- } else {
15
- terminalCtor = require('./unixTerminal').UnixTerminal;
16
- }
17
-
18
- /**
19
- * Forks a process as a pseudoterminal.
20
- * @param file The file to launch.
21
- * @param args The file's arguments as argv (string[]) or in a pre-escaped
22
- * CommandLine format (string). Note that the CommandLine option is only
23
- * available on Windows and is expected to be escaped properly.
24
- * @param options The options of the terminal.
25
- * @throws When the file passed to spawn with does not exists.
26
- * @see CommandLineToArgvW https://msdn.microsoft.com/en-us/library/windows/desktop/bb776391(v=vs.85).aspx
27
- * @see Parsing C++ Comamnd-Line Arguments https://msdn.microsoft.com/en-us/library/17w5ykft.aspx
28
- * @see GetCommandLine https://msdn.microsoft.com/en-us/library/windows/desktop/ms683156.aspx
29
- */
30
- export function spawn(file?: string, args?: ArgvOrCommandLine, opt?: IPtyForkOptions | IWindowsPtyForkOptions): ITerminal {
31
- return new terminalCtor(file, args, opt);
32
- }
33
-
34
- /** @deprecated */
35
- export function fork(file?: string, args?: ArgvOrCommandLine, opt?: IPtyForkOptions | IWindowsPtyForkOptions): ITerminal {
36
- return new terminalCtor(file, args, opt);
37
- }
38
-
39
- /** @deprecated */
40
- export function createTerminal(file?: string, args?: ArgvOrCommandLine, opt?: IPtyForkOptions | IWindowsPtyForkOptions): ITerminal {
41
- return new terminalCtor(file, args, opt);
42
- }
43
-
44
- export function open(options: IPtyOpenOptions): ITerminal {
45
- return terminalCtor.open(options);
46
- }
47
-
48
- /**
49
- * Expose the native API when not Windows, note that this is not public API and
50
- * could be removed at any time.
51
- */
52
- export const native = (process.platform !== 'win32' ? loadNativeModule('pty').module : null);