@vibedeckx/linux-x64 0.1.17 → 0.1.19
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/dist/process-manager.d.ts +1 -1
- package/dist/process-manager.js +102 -42
- package/dist/ui/404/index.html +1 -1
- package/dist/ui/404.html +1 -1
- package/dist/ui/__next.__PAGE__.txt +1 -1
- package/dist/ui/__next._full.txt +1 -1
- package/dist/ui/__next._head.txt +1 -1
- package/dist/ui/__next._index.txt +1 -1
- package/dist/ui/__next._tree.txt +1 -1
- package/dist/ui/_not-found/__next._full.txt +1 -1
- package/dist/ui/_not-found/__next._head.txt +1 -1
- package/dist/ui/_not-found/__next._index.txt +1 -1
- package/dist/ui/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/dist/ui/_not-found/__next._not-found.txt +1 -1
- package/dist/ui/_not-found/__next._tree.txt +1 -1
- package/dist/ui/_not-found/index.html +1 -1
- package/dist/ui/_not-found/index.txt +1 -1
- package/dist/ui/index.html +1 -1
- package/dist/ui/index.txt +1 -1
- package/node_modules/node-pty/lib/conpty_console_list_agent.js +10 -1
- package/node_modules/node-pty/lib/unixTerminal.js +6 -3
- package/node_modules/node-pty/lib/utils.js +1 -1
- package/node_modules/node-pty/lib/windowsPtyAgent.js +62 -95
- package/node_modules/node-pty/lib/windowsTerminal.js +4 -2
- package/node_modules/node-pty/package.json +6 -5
- package/node_modules/node-pty/prebuilds/linux-x64/pty.node +0 -0
- package/package.json +2 -2
- package/node_modules/node-pty/build/Release/pty.node +0 -0
- package/node_modules/node-pty/build/binding.Makefile +0 -6
- package/node_modules/node-pty/build/pty.target.mk +0 -168
- package/node_modules/node-pty/lib/eventEmitter2.test.js +0 -30
- package/node_modules/node-pty/lib/terminal.test.js +0 -139
- package/node_modules/node-pty/lib/testUtils.test.js +0 -28
- package/node_modules/node-pty/lib/unixTerminal.test.js +0 -351
- package/node_modules/node-pty/lib/windowsPtyAgent.test.js +0 -90
- package/node_modules/node-pty/lib/windowsTerminal.test.js +0 -219
- /package/dist/ui/_next/static/{KwSMuRKWgTp_quB8AMAmD → VUA3uJYddmpvYUPcharb_}/_buildManifest.js +0 -0
- /package/dist/ui/_next/static/{KwSMuRKWgTp_quB8AMAmD → VUA3uJYddmpvYUPcharb_}/_clientMiddlewareManifest.json +0 -0
- /package/dist/ui/_next/static/{KwSMuRKWgTp_quB8AMAmD → VUA3uJYddmpvYUPcharb_}/_ssgManifest.js +0 -0
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2017, Daniel Imms (MIT License).
|
|
4
|
-
* Copyright (c) 2018, Microsoft Corporation (MIT License).
|
|
5
|
-
*/
|
|
6
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
16
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
17
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
18
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
19
|
-
function step(op) {
|
|
20
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
21
|
-
while (_) try {
|
|
22
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
23
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
24
|
-
switch (op[0]) {
|
|
25
|
-
case 0: case 1: t = op; break;
|
|
26
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
27
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
28
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
29
|
-
default:
|
|
30
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
31
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
32
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
33
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
34
|
-
if (t[2]) _.ops.pop();
|
|
35
|
-
_.trys.pop(); continue;
|
|
36
|
-
}
|
|
37
|
-
op = body.call(thisArg, _);
|
|
38
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
39
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
var unixTerminal_1 = require("./unixTerminal");
|
|
44
|
-
var assert = require("assert");
|
|
45
|
-
var cp = require("child_process");
|
|
46
|
-
var path = require("path");
|
|
47
|
-
var tty = require("tty");
|
|
48
|
-
var fs = require("fs");
|
|
49
|
-
var os_1 = require("os");
|
|
50
|
-
var testUtils_test_1 = require("./testUtils.test");
|
|
51
|
-
var FIXTURES_PATH = path.normalize(path.join(__dirname, '..', 'fixtures', 'utf8-character.txt'));
|
|
52
|
-
if (process.platform !== 'win32') {
|
|
53
|
-
describe('UnixTerminal', function () {
|
|
54
|
-
describe('Constructor', function () {
|
|
55
|
-
it('should set a valid pts name', function () {
|
|
56
|
-
var term = new unixTerminal_1.UnixTerminal('/bin/bash', [], {});
|
|
57
|
-
var regExp;
|
|
58
|
-
if (process.platform === 'linux') {
|
|
59
|
-
// https://linux.die.net/man/4/pts
|
|
60
|
-
regExp = /^\/dev\/pts\/\d+$/;
|
|
61
|
-
}
|
|
62
|
-
if (process.platform === 'darwin') {
|
|
63
|
-
// https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man4/pty.4.html
|
|
64
|
-
regExp = /^\/dev\/tty[p-sP-S][a-z0-9]+$/;
|
|
65
|
-
}
|
|
66
|
-
if (regExp) {
|
|
67
|
-
assert.ok(regExp.test(term.ptsName), '"' + term.ptsName + '" should match ' + regExp.toString());
|
|
68
|
-
}
|
|
69
|
-
assert.ok(tty.isatty(term.fd));
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
describe('PtyForkEncodingOption', function () {
|
|
73
|
-
it('should default to utf8', function (done) {
|
|
74
|
-
var term = new unixTerminal_1.UnixTerminal('/bin/bash', ['-c', "cat \"" + FIXTURES_PATH + "\""]);
|
|
75
|
-
term.on('data', function (data) {
|
|
76
|
-
assert.strictEqual(typeof data, 'string');
|
|
77
|
-
assert.strictEqual(data, '\u00E6');
|
|
78
|
-
done();
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
it('should return a Buffer when encoding is null', function (done) {
|
|
82
|
-
var term = new unixTerminal_1.UnixTerminal('/bin/bash', ['-c', "cat \"" + FIXTURES_PATH + "\""], {
|
|
83
|
-
encoding: null
|
|
84
|
-
});
|
|
85
|
-
term.on('data', function (data) {
|
|
86
|
-
assert.strictEqual(typeof data, 'object');
|
|
87
|
-
assert.ok(data instanceof Buffer);
|
|
88
|
-
assert.strictEqual(0xC3, data[0]);
|
|
89
|
-
assert.strictEqual(0xA6, data[1]);
|
|
90
|
-
done();
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
it('should support other encodings', function (done) {
|
|
94
|
-
var text = 'test æ!';
|
|
95
|
-
var term = new unixTerminal_1.UnixTerminal(undefined, ['-c', 'echo "' + text + '"'], {
|
|
96
|
-
encoding: 'base64'
|
|
97
|
-
});
|
|
98
|
-
var buffer = '';
|
|
99
|
-
term.onData(function (data) {
|
|
100
|
-
assert.strictEqual(typeof data, 'string');
|
|
101
|
-
buffer += data;
|
|
102
|
-
});
|
|
103
|
-
term.onExit(function () {
|
|
104
|
-
assert.strictEqual(Buffer.alloc(8, buffer, 'base64').toString().replace('\r', '').replace('\n', ''), text);
|
|
105
|
-
done();
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
describe('open', function () {
|
|
110
|
-
var term;
|
|
111
|
-
afterEach(function () {
|
|
112
|
-
if (term) {
|
|
113
|
-
term.slave.destroy();
|
|
114
|
-
term.master.destroy();
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
it('should open a pty with access to a master and slave socket', function (done) {
|
|
118
|
-
term = unixTerminal_1.UnixTerminal.open({});
|
|
119
|
-
var slavebuf = '';
|
|
120
|
-
term.slave.on('data', function (data) {
|
|
121
|
-
slavebuf += data;
|
|
122
|
-
});
|
|
123
|
-
var masterbuf = '';
|
|
124
|
-
term.master.on('data', function (data) {
|
|
125
|
-
masterbuf += data;
|
|
126
|
-
});
|
|
127
|
-
testUtils_test_1.pollUntil(function () {
|
|
128
|
-
if (masterbuf === 'slave\r\nmaster\r\n' && slavebuf === 'master\n') {
|
|
129
|
-
done();
|
|
130
|
-
return true;
|
|
131
|
-
}
|
|
132
|
-
return false;
|
|
133
|
-
}, 200, 10);
|
|
134
|
-
term.slave.write('slave\n');
|
|
135
|
-
term.master.write('master\n');
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
describe('close', function () {
|
|
139
|
-
var term = new unixTerminal_1.UnixTerminal('node');
|
|
140
|
-
it('should exit when terminal is destroyed programmatically', function (done) {
|
|
141
|
-
term.on('exit', function (code, signal) {
|
|
142
|
-
assert.strictEqual(code, 0);
|
|
143
|
-
assert.strictEqual(signal, os_1.constants.signals.SIGHUP);
|
|
144
|
-
done();
|
|
145
|
-
});
|
|
146
|
-
term.destroy();
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
describe('signals in parent and child', function () {
|
|
150
|
-
it('SIGINT - custom in parent and child', function (done) {
|
|
151
|
-
// this test is cumbersome - we have to run it in a sub process to
|
|
152
|
-
// see behavior of SIGINT handlers
|
|
153
|
-
var data = "\n var pty = require('./lib/index');\n process.on('SIGINT', () => console.log('SIGINT in parent'));\n var ptyProcess = pty.spawn('node', ['-e', 'process.on(\"SIGINT\", ()=>console.log(\"SIGINT in child\"));setTimeout(() => null, 300);'], {\n name: 'xterm-color',\n cols: 80,\n rows: 30,\n cwd: process.env.HOME,\n env: process.env\n });\n ptyProcess.on('data', function (data) {\n console.log(data);\n });\n setTimeout(() => null, 500);\n console.log('ready', ptyProcess.pid);\n ";
|
|
154
|
-
var buffer = [];
|
|
155
|
-
var p = cp.spawn('node', ['-e', data]);
|
|
156
|
-
var sub = '';
|
|
157
|
-
p.stdout.on('data', function (data) {
|
|
158
|
-
if (!data.toString().indexOf('ready')) {
|
|
159
|
-
sub = data.toString().split(' ')[1].slice(0, -1);
|
|
160
|
-
setTimeout(function () {
|
|
161
|
-
process.kill(parseInt(sub), 'SIGINT'); // SIGINT to child
|
|
162
|
-
p.kill('SIGINT'); // SIGINT to parent
|
|
163
|
-
}, 200);
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
buffer.push(data.toString().replace(/^\s+|\s+$/g, ''));
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
p.on('close', function () {
|
|
170
|
-
// handlers in parent and child should have been triggered
|
|
171
|
-
assert.strictEqual(buffer.indexOf('SIGINT in child') !== -1, true);
|
|
172
|
-
assert.strictEqual(buffer.indexOf('SIGINT in parent') !== -1, true);
|
|
173
|
-
done();
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
it('SIGINT - custom in parent, default in child', function (done) {
|
|
177
|
-
// this tests the original idea of the signal(...) change in pty.cc:
|
|
178
|
-
// to make sure the SIGINT handler of a pty child is reset to default
|
|
179
|
-
// and does not interfere with the handler in the parent
|
|
180
|
-
var data = "\n var pty = require('./lib/index');\n process.on('SIGINT', () => console.log('SIGINT in parent'));\n var ptyProcess = pty.spawn('node', ['-e', 'setTimeout(() => console.log(\"should not be printed\"), 300);'], {\n name: 'xterm-color',\n cols: 80,\n rows: 30,\n cwd: process.env.HOME,\n env: process.env\n });\n ptyProcess.on('data', function (data) {\n console.log(data);\n });\n setTimeout(() => null, 500);\n console.log('ready', ptyProcess.pid);\n ";
|
|
181
|
-
var buffer = [];
|
|
182
|
-
var p = cp.spawn('node', ['-e', data]);
|
|
183
|
-
var sub = '';
|
|
184
|
-
p.stdout.on('data', function (data) {
|
|
185
|
-
if (!data.toString().indexOf('ready')) {
|
|
186
|
-
sub = data.toString().split(' ')[1].slice(0, -1);
|
|
187
|
-
setTimeout(function () {
|
|
188
|
-
process.kill(parseInt(sub), 'SIGINT'); // SIGINT to child
|
|
189
|
-
p.kill('SIGINT'); // SIGINT to parent
|
|
190
|
-
}, 200);
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
buffer.push(data.toString().replace(/^\s+|\s+$/g, ''));
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
p.on('close', function () {
|
|
197
|
-
// handlers in parent and child should have been triggered
|
|
198
|
-
assert.strictEqual(buffer.indexOf('should not be printed') !== -1, false);
|
|
199
|
-
assert.strictEqual(buffer.indexOf('SIGINT in parent') !== -1, true);
|
|
200
|
-
done();
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
it('SIGHUP default (child only)', function (done) {
|
|
204
|
-
var term = new unixTerminal_1.UnixTerminal('node', ['-e', "\n console.log('ready');\n setTimeout(()=>console.log('timeout'), 200);"
|
|
205
|
-
]);
|
|
206
|
-
var buffer = '';
|
|
207
|
-
term.on('data', function (data) {
|
|
208
|
-
if (data === 'ready\r\n') {
|
|
209
|
-
term.kill();
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
buffer += data;
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
term.on('exit', function () {
|
|
216
|
-
// no timeout in buffer
|
|
217
|
-
assert.strictEqual(buffer, '');
|
|
218
|
-
done();
|
|
219
|
-
});
|
|
220
|
-
});
|
|
221
|
-
it('SIGUSR1 - custom in parent and child', function (done) {
|
|
222
|
-
var pHandlerCalled = 0;
|
|
223
|
-
var handleSigUsr = function (h) {
|
|
224
|
-
return function () {
|
|
225
|
-
pHandlerCalled += 1;
|
|
226
|
-
process.removeListener('SIGUSR1', h);
|
|
227
|
-
};
|
|
228
|
-
};
|
|
229
|
-
process.on('SIGUSR1', handleSigUsr(handleSigUsr));
|
|
230
|
-
var term = new unixTerminal_1.UnixTerminal('node', ['-e', "\n process.on('SIGUSR1', () => {\n console.log('SIGUSR1 in child');\n });\n console.log('ready');\n setTimeout(()=>null, 200);"
|
|
231
|
-
]);
|
|
232
|
-
var buffer = '';
|
|
233
|
-
term.on('data', function (data) {
|
|
234
|
-
if (data === 'ready\r\n') {
|
|
235
|
-
process.kill(process.pid, 'SIGUSR1');
|
|
236
|
-
term.kill('SIGUSR1');
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
239
|
-
buffer += data;
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
term.on('exit', function () {
|
|
243
|
-
// should have called both handlers and only once
|
|
244
|
-
assert.strictEqual(pHandlerCalled, 1);
|
|
245
|
-
assert.strictEqual(buffer, 'SIGUSR1 in child\r\n');
|
|
246
|
-
done();
|
|
247
|
-
});
|
|
248
|
-
});
|
|
249
|
-
});
|
|
250
|
-
describe('spawn', function () {
|
|
251
|
-
if (process.platform === 'darwin') {
|
|
252
|
-
it('should return the name of the process', function (done) {
|
|
253
|
-
var term = new unixTerminal_1.UnixTerminal('/bin/echo');
|
|
254
|
-
assert.strictEqual(term.process, '/bin/echo');
|
|
255
|
-
term.on('exit', function () { return done(); });
|
|
256
|
-
term.destroy();
|
|
257
|
-
});
|
|
258
|
-
it('should return the name of the sub process', function (done) {
|
|
259
|
-
var data = "\n var pty = require('./lib/index');\n var ptyProcess = pty.spawn('zsh', ['-c', 'python3'], {\n env: process.env\n });\n ptyProcess.on('data', function (data) {\n if (ptyProcess.process === 'Python') {\n console.log('title', ptyProcess.process);\n console.log('ready', ptyProcess.pid);\n }\n });\n ";
|
|
260
|
-
var p = cp.spawn('node', ['-e', data]);
|
|
261
|
-
var sub = '';
|
|
262
|
-
var pid = '';
|
|
263
|
-
p.stdout.on('data', function (data) {
|
|
264
|
-
if (!data.toString().indexOf('title')) {
|
|
265
|
-
sub = data.toString().split(' ')[1].slice(0, -1);
|
|
266
|
-
}
|
|
267
|
-
else if (!data.toString().indexOf('ready')) {
|
|
268
|
-
pid = data.toString().split(' ')[1].slice(0, -1);
|
|
269
|
-
process.kill(parseInt(pid), 'SIGINT');
|
|
270
|
-
p.kill('SIGINT');
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
p.on('exit', function () {
|
|
274
|
-
assert.notStrictEqual(pid, '');
|
|
275
|
-
assert.strictEqual(sub, 'Python');
|
|
276
|
-
done();
|
|
277
|
-
});
|
|
278
|
-
});
|
|
279
|
-
it('should close on exec', function (done) {
|
|
280
|
-
var data = "\n var pty = require('./lib/index');\n var ptyProcess = pty.spawn('node', ['-e', 'setTimeout(() => console.log(\"hello from terminal\"), 300);']);\n ptyProcess.on('data', function (data) {\n console.log(data);\n });\n setTimeout(() => null, 500);\n console.log('ready', ptyProcess.pid);\n ";
|
|
281
|
-
var buffer = [];
|
|
282
|
-
var readFd = fs.openSync(FIXTURES_PATH, 'r');
|
|
283
|
-
var p = cp.spawn('node', ['-e', data], {
|
|
284
|
-
stdio: ['ignore', 'pipe', 'pipe', readFd]
|
|
285
|
-
});
|
|
286
|
-
var sub = '';
|
|
287
|
-
p.stdout.on('data', function (data) {
|
|
288
|
-
if (!data.toString().indexOf('ready')) {
|
|
289
|
-
sub = data.toString().split(' ')[1].slice(0, -1);
|
|
290
|
-
try {
|
|
291
|
-
fs.statSync("/proc/" + sub + "/fd/" + readFd);
|
|
292
|
-
done('not reachable');
|
|
293
|
-
}
|
|
294
|
-
catch (error) {
|
|
295
|
-
assert.notStrictEqual(error.message.indexOf('ENOENT'), -1);
|
|
296
|
-
}
|
|
297
|
-
setTimeout(function () {
|
|
298
|
-
process.kill(parseInt(sub), 'SIGINT'); // SIGINT to child
|
|
299
|
-
p.kill('SIGINT'); // SIGINT to parent
|
|
300
|
-
}, 200);
|
|
301
|
-
}
|
|
302
|
-
else {
|
|
303
|
-
buffer.push(data.toString().replace(/^\s+|\s+$/g, ''));
|
|
304
|
-
}
|
|
305
|
-
});
|
|
306
|
-
p.on('close', function () {
|
|
307
|
-
done();
|
|
308
|
-
});
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
it('should handle exec() errors', function (done) {
|
|
312
|
-
var term = new unixTerminal_1.UnixTerminal('/bin/bogus.exe', []);
|
|
313
|
-
term.on('exit', function (code, signal) {
|
|
314
|
-
assert.strictEqual(code, 1);
|
|
315
|
-
done();
|
|
316
|
-
});
|
|
317
|
-
});
|
|
318
|
-
it('should handle chdir() errors', function (done) {
|
|
319
|
-
var term = new unixTerminal_1.UnixTerminal('/bin/echo', [], { cwd: '/nowhere' });
|
|
320
|
-
term.on('exit', function (code, signal) {
|
|
321
|
-
assert.strictEqual(code, 1);
|
|
322
|
-
done();
|
|
323
|
-
});
|
|
324
|
-
});
|
|
325
|
-
it('should not leak child process', function (done) {
|
|
326
|
-
var count = cp.execSync('ps -ax | grep node | wc -l');
|
|
327
|
-
var term = new unixTerminal_1.UnixTerminal('node', ['-e', "\n console.log('ready');\n setTimeout(()=>console.log('timeout'), 200);"
|
|
328
|
-
]);
|
|
329
|
-
term.on('data', function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
330
|
-
var newCount;
|
|
331
|
-
return __generator(this, function (_a) {
|
|
332
|
-
switch (_a.label) {
|
|
333
|
-
case 0:
|
|
334
|
-
if (!(data === 'ready\r\n')) return [3 /*break*/, 2];
|
|
335
|
-
process.kill(term.pid, 'SIGINT');
|
|
336
|
-
return [4 /*yield*/, setTimeout(function () { return null; }, 1000)];
|
|
337
|
-
case 1:
|
|
338
|
-
_a.sent();
|
|
339
|
-
newCount = cp.execSync('ps -ax | grep node | wc -l');
|
|
340
|
-
assert.strictEqual(count.toString(), newCount.toString());
|
|
341
|
-
done();
|
|
342
|
-
_a.label = 2;
|
|
343
|
-
case 2: return [2 /*return*/];
|
|
344
|
-
}
|
|
345
|
-
});
|
|
346
|
-
}); });
|
|
347
|
-
});
|
|
348
|
-
});
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
//# sourceMappingURL=unixTerminal.test.js.map
|
|
@@ -1,90 +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 assert = require("assert");
|
|
8
|
-
var windowsPtyAgent_1 = require("./windowsPtyAgent");
|
|
9
|
-
function check(file, args, expected) {
|
|
10
|
-
assert.equal(windowsPtyAgent_1.argsToCommandLine(file, args), expected);
|
|
11
|
-
}
|
|
12
|
-
if (process.platform === 'win32') {
|
|
13
|
-
describe('argsToCommandLine', function () {
|
|
14
|
-
describe('Plain strings', function () {
|
|
15
|
-
it('doesn\'t quote plain string', function () {
|
|
16
|
-
check('asdf', [], 'asdf');
|
|
17
|
-
});
|
|
18
|
-
it('doesn\'t escape backslashes', function () {
|
|
19
|
-
check('\\asdf\\qwer\\', [], '\\asdf\\qwer\\');
|
|
20
|
-
});
|
|
21
|
-
it('doesn\'t escape multiple backslashes', function () {
|
|
22
|
-
check('asdf\\\\qwer', [], 'asdf\\\\qwer');
|
|
23
|
-
});
|
|
24
|
-
it('adds backslashes before quotes', function () {
|
|
25
|
-
check('"asdf"qwer"', [], '\\"asdf\\"qwer\\"');
|
|
26
|
-
});
|
|
27
|
-
it('escapes backslashes before quotes', function () {
|
|
28
|
-
check('asdf\\"qwer', [], 'asdf\\\\\\"qwer');
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
describe('Quoted strings', function () {
|
|
32
|
-
it('quotes string with spaces', function () {
|
|
33
|
-
check('asdf qwer', [], '"asdf qwer"');
|
|
34
|
-
});
|
|
35
|
-
it('quotes empty string', function () {
|
|
36
|
-
check('', [], '""');
|
|
37
|
-
});
|
|
38
|
-
it('quotes string with tabs', function () {
|
|
39
|
-
check('asdf\tqwer', [], '"asdf\tqwer"');
|
|
40
|
-
});
|
|
41
|
-
it('escapes only the last backslash', function () {
|
|
42
|
-
check('\\asdf \\qwer\\', [], '"\\asdf \\qwer\\\\"');
|
|
43
|
-
});
|
|
44
|
-
it('doesn\'t escape multiple backslashes', function () {
|
|
45
|
-
check('asdf \\\\qwer', [], '"asdf \\\\qwer"');
|
|
46
|
-
});
|
|
47
|
-
it('escapes backslashes before quotes', function () {
|
|
48
|
-
check('asdf \\"qwer', [], '"asdf \\\\\\"qwer"');
|
|
49
|
-
});
|
|
50
|
-
it('escapes multiple backslashes at the end', function () {
|
|
51
|
-
check('asdf qwer\\\\', [], '"asdf qwer\\\\\\\\"');
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
describe('Multiple arguments', function () {
|
|
55
|
-
it('joins arguments with spaces', function () {
|
|
56
|
-
check('asdf', ['qwer zxcv', '', '"'], 'asdf "qwer zxcv" "" \\"');
|
|
57
|
-
});
|
|
58
|
-
it('array argument all in quotes', function () {
|
|
59
|
-
check('asdf', ['"surounded by quotes"'], 'asdf \\"surounded by quotes\\"');
|
|
60
|
-
});
|
|
61
|
-
it('array argument quotes in the middle', function () {
|
|
62
|
-
check('asdf', ['quotes "in the" middle'], 'asdf "quotes \\"in the\\" middle"');
|
|
63
|
-
});
|
|
64
|
-
it('array argument quotes near start', function () {
|
|
65
|
-
check('asdf', ['"quotes" near start'], 'asdf "\\"quotes\\" near start"');
|
|
66
|
-
});
|
|
67
|
-
it('array argument quotes near end', function () {
|
|
68
|
-
check('asdf', ['quotes "near end"'], 'asdf "quotes \\"near end\\""');
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
describe('Args as CommandLine', function () {
|
|
72
|
-
it('should handle empty string', function () {
|
|
73
|
-
check('file', '', 'file');
|
|
74
|
-
});
|
|
75
|
-
it('should not change args', function () {
|
|
76
|
-
check('file', 'foo bar baz', 'file foo bar baz');
|
|
77
|
-
check('file', 'foo \\ba"r \baz', 'file foo \\ba"r \baz');
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
describe('Real-world cases', function () {
|
|
81
|
-
it('quotes within quotes', function () {
|
|
82
|
-
check('cmd.exe', ['/c', 'powershell -noexit -command \'Set-location \"C:\\user\"\''], 'cmd.exe /c "powershell -noexit -command \'Set-location \\\"C:\\user\\"\'"');
|
|
83
|
-
});
|
|
84
|
-
it('space within quotes', function () {
|
|
85
|
-
check('cmd.exe', ['/k', '"C:\\Users\\alros\\Desktop\\test script.bat"'], 'cmd.exe /k \\"C:\\Users\\alros\\Desktop\\test script.bat\\"');
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
//# sourceMappingURL=windowsPtyAgent.test.js.map
|
|
@@ -1,219 +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, false], [true, false], [true, true]].forEach(function (_a) {
|
|
92
|
-
var useConpty = _a[0], useConptyDll = _a[1];
|
|
93
|
-
describe("WindowsTerminal (useConpty = " + useConpty + ", useConptyDll = " + useConptyDll + ")", function () {
|
|
94
|
-
describe('kill', function () {
|
|
95
|
-
it('should not crash parent process', function (done) {
|
|
96
|
-
this.timeout(20000);
|
|
97
|
-
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], { useConpty: useConpty, useConptyDll: useConptyDll });
|
|
98
|
-
term.on('exit', function () { return done(); });
|
|
99
|
-
term.kill();
|
|
100
|
-
});
|
|
101
|
-
it('should kill the process tree', function (done) {
|
|
102
|
-
this.timeout(20000);
|
|
103
|
-
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], { useConpty: useConpty, useConptyDll: useConptyDll });
|
|
104
|
-
// Start sub-processes
|
|
105
|
-
term.write('powershell.exe\r');
|
|
106
|
-
term.write('node.exe\r');
|
|
107
|
-
console.log('start poll for tree size');
|
|
108
|
-
pollForProcessTreeSize(term.pid, 3, 500, 5000).then(function (list) {
|
|
109
|
-
assert.strictEqual(list[0].name.toLowerCase(), 'cmd.exe');
|
|
110
|
-
assert.strictEqual(list[1].name.toLowerCase(), 'powershell.exe');
|
|
111
|
-
assert.strictEqual(list[2].name.toLowerCase(), 'node.exe');
|
|
112
|
-
term.kill();
|
|
113
|
-
var desiredState = {};
|
|
114
|
-
desiredState[list[0].pid] = false;
|
|
115
|
-
desiredState[list[1].pid] = false;
|
|
116
|
-
desiredState[list[2].pid] = false;
|
|
117
|
-
term.on('exit', function () {
|
|
118
|
-
pollForProcessState(desiredState, 1000, 5000).then(function () {
|
|
119
|
-
done();
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
describe('resize', function () {
|
|
126
|
-
it('should throw a non-native exception when resizing an invalid value', function (done) {
|
|
127
|
-
this.timeout(20000);
|
|
128
|
-
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], { useConpty: useConpty, useConptyDll: useConptyDll });
|
|
129
|
-
assert.throws(function () { return term.resize(-1, -1); });
|
|
130
|
-
assert.throws(function () { return term.resize(0, 0); });
|
|
131
|
-
assert.doesNotThrow(function () { return term.resize(1, 1); });
|
|
132
|
-
term.on('exit', function () {
|
|
133
|
-
done();
|
|
134
|
-
});
|
|
135
|
-
term.kill();
|
|
136
|
-
});
|
|
137
|
-
it('should throw a non-native exception when resizing a killed terminal', function (done) {
|
|
138
|
-
this.timeout(20000);
|
|
139
|
-
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], { useConpty: useConpty, useConptyDll: useConptyDll });
|
|
140
|
-
term._defer(function () {
|
|
141
|
-
term.once('exit', function () {
|
|
142
|
-
assert.throws(function () { return term.resize(1, 1); });
|
|
143
|
-
done();
|
|
144
|
-
});
|
|
145
|
-
term.destroy();
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
describe('Args as CommandLine', function () {
|
|
150
|
-
it('should not fail running a file containing a space in the path', function (done) {
|
|
151
|
-
this.timeout(10000);
|
|
152
|
-
var spaceFolder = path.resolve(__dirname, '..', 'fixtures', 'space folder');
|
|
153
|
-
if (!fs.existsSync(spaceFolder)) {
|
|
154
|
-
fs.mkdirSync(spaceFolder);
|
|
155
|
-
}
|
|
156
|
-
var cmdCopiedPath = path.resolve(spaceFolder, 'cmd.exe');
|
|
157
|
-
var data = fs.readFileSync(process.env.windir + "\\System32\\cmd.exe");
|
|
158
|
-
fs.writeFileSync(cmdCopiedPath, data);
|
|
159
|
-
if (!fs.existsSync(cmdCopiedPath)) {
|
|
160
|
-
// Skip test if git bash isn't installed
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
var term = new windowsTerminal_1.WindowsTerminal(cmdCopiedPath, '/c echo "hello world"', { useConpty: useConpty, useConptyDll: useConptyDll });
|
|
164
|
-
var result = '';
|
|
165
|
-
term.on('data', function (data) {
|
|
166
|
-
result += data;
|
|
167
|
-
});
|
|
168
|
-
term.on('exit', function () {
|
|
169
|
-
assert.ok(result.indexOf('hello world') >= 1);
|
|
170
|
-
done();
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
describe('env', function () {
|
|
175
|
-
it('should set environment variables of the shell', function (done) {
|
|
176
|
-
this.timeout(10000);
|
|
177
|
-
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '/C echo %FOO%', { useConpty: useConpty, useConptyDll: useConptyDll, env: { FOO: 'BAR' } });
|
|
178
|
-
var result = '';
|
|
179
|
-
term.on('data', function (data) {
|
|
180
|
-
result += data;
|
|
181
|
-
});
|
|
182
|
-
term.on('exit', function () {
|
|
183
|
-
assert.ok(result.indexOf('BAR') >= 0);
|
|
184
|
-
done();
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
describe('On close', function () {
|
|
189
|
-
it('should return process zero exit codes', function (done) {
|
|
190
|
-
this.timeout(10000);
|
|
191
|
-
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '/C exit', { useConpty: useConpty, useConptyDll: useConptyDll });
|
|
192
|
-
term.on('exit', function (code) {
|
|
193
|
-
assert.strictEqual(code, 0);
|
|
194
|
-
done();
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
it('should return process non-zero exit codes', function (done) {
|
|
198
|
-
this.timeout(10000);
|
|
199
|
-
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '/C exit 2', { useConpty: useConpty, useConptyDll: useConptyDll });
|
|
200
|
-
term.on('exit', function (code) {
|
|
201
|
-
assert.strictEqual(code, 2);
|
|
202
|
-
done();
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
describe('Write', function () {
|
|
207
|
-
it('should accept input', function (done) {
|
|
208
|
-
this.timeout(10000);
|
|
209
|
-
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '', { useConpty: useConpty, useConptyDll: useConptyDll });
|
|
210
|
-
term.write('exit\r');
|
|
211
|
-
term.on('exit', function () {
|
|
212
|
-
done();
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
});
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
//# sourceMappingURL=windowsTerminal.test.js.map
|
/package/dist/ui/_next/static/{KwSMuRKWgTp_quB8AMAmD → VUA3uJYddmpvYUPcharb_}/_buildManifest.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/ui/_next/static/{KwSMuRKWgTp_quB8AMAmD → VUA3uJYddmpvYUPcharb_}/_ssgManifest.js
RENAMED
|
File without changes
|