node-pty 1.1.0-beta27 → 1.1.0-beta29
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/lib/windowsConoutConnection.js +0 -4
- package/lib/windowsConoutConnection.js.map +1 -1
- package/lib/windowsPtyAgent.js +35 -17
- package/lib/windowsPtyAgent.js.map +1 -1
- package/lib/windowsTerminal.test.js +37 -25
- package/lib/windowsTerminal.test.js.map +1 -1
- package/lib/worker/conoutSocketWorker.js +13 -10
- package/lib/worker/conoutSocketWorker.js.map +1 -1
- package/package.json +1 -1
- package/scripts/increment-version.js +54 -0
- package/scripts/publish.js +7 -4
- package/src/native.d.ts +1 -1
- package/src/win/conpty.cc +39 -26
- package/src/windowsConoutConnection.ts +0 -4
- package/src/windowsPtyAgent.ts +32 -15
- package/src/windowsTerminal.test.ts +42 -31
- package/src/worker/conoutSocketWorker.ts +14 -11
- package/third_party/conpty/1.22.250204002/win10-arm64/OpenConsole.exe +0 -0
- package/third_party/conpty/1.22.250204002/win10-arm64/conpty.dll +0 -0
- package/third_party/conpty/1.22.250204002/win10-x64/OpenConsole.exe +0 -0
- package/third_party/conpty/1.22.250204002/win10-x64/conpty.dll +0 -0
- package/third_party/conpty/1.20.240626001/win10-arm64/OpenConsole.exe +0 -0
- package/third_party/conpty/1.20.240626001/win10-arm64/conpty.dll +0 -0
- package/third_party/conpty/1.20.240626001/win10-x64/OpenConsole.exe +0 -0
- package/third_party/conpty/1.20.240626001/win10-x64/conpty.dll +0 -0
|
@@ -87,10 +87,6 @@ var ConoutConnection = /** @class */ (function () {
|
|
|
87
87
|
configurable: true
|
|
88
88
|
});
|
|
89
89
|
ConoutConnection.prototype.dispose = function () {
|
|
90
|
-
if (this._isDisposed) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
this._isDisposed = true;
|
|
94
90
|
// Drain all data from the socket before closing
|
|
95
91
|
this._drainDataAndClose();
|
|
96
92
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"windowsConoutConnection.js","sourceRoot":"","sources":["../src/windowsConoutConnection.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iDAAwC;AAGxC,0CAAsF;AACtF,6BAA4B;AAC5B,iDAAwD;AAExD;;;;GAIG;AACH,IAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC;;;;;;;;;;;GAWG;AACH;IAQE,0BACU,eAAuB;QADjC,iBAeC;QAdS,oBAAe,GAAf,eAAe,CAAQ;QANzB,gBAAW,GAAY,KAAK,CAAC;QAE7B,aAAQ,GAAG,IAAI,6BAAa,EAAQ,CAAC;QAM3C,IAAM,UAAU,GAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;QACpE,IAAM,UAAU,GAAG,SAAS,CAAC,OAAO,CAAC,mBAAmB,EAAE,4BAA4B,CAAC,CAAC;QACxF,IAAI,CAAC,OAAO,GAAG,IAAI,uBAAM,CAAC,WAAI,CAAC,UAAU,EAAE,8BAA8B,CAAC,EAAE,EAAE,UAAU,YAAA,EAAE,CAAC,CAAC;QAC5F,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,UAAC,OAA4B;YACtD,QAAQ,OAAO,EAAE;gBACf;oBACE,KAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;oBACrB,OAAO;gBACT;oBACE,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;aAC3D;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAjBD,sBAAW,qCAAO;aAAlB,cAAqC,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;;;OAAA;IAmBlE,kCAAO,GAAP;QACE,
|
|
1
|
+
{"version":3,"file":"windowsConoutConnection.js","sourceRoot":"","sources":["../src/windowsConoutConnection.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;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AAa,EAAE;YACtB,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SAClC;QACD,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,cAAM,OAAA,KAAI,CAAC,cAAc,EAAE,EAArB,CAAqB,EAAE,mBAAmB,CAAC,CAAC;IACpF,CAAC;IAEa,yCAAc,GAA5B;;;;4BACE,qBAAM,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAA;;wBAA9B,SAA8B,CAAC;;;;;KAChC;IACH,uBAAC;AAAD,CAAC,AA5CD,IA4CC;AA5CY,4CAAgB"}
|
package/lib/windowsPtyAgent.js
CHANGED
|
@@ -9,8 +9,8 @@ exports.argsToCommandLine = exports.WindowsPtyAgent = void 0;
|
|
|
9
9
|
var fs = require("fs");
|
|
10
10
|
var os = require("os");
|
|
11
11
|
var path = require("path");
|
|
12
|
-
var net_1 = require("net");
|
|
13
12
|
var child_process_1 = require("child_process");
|
|
13
|
+
var net_1 = require("net");
|
|
14
14
|
var windowsConoutConnection_1 = require("./windowsConoutConnection");
|
|
15
15
|
var conptyNative;
|
|
16
16
|
var winptyNative;
|
|
@@ -109,7 +109,7 @@ var WindowsPtyAgent = /** @class */ (function () {
|
|
|
109
109
|
});
|
|
110
110
|
this._inSocket.setEncoding('utf8');
|
|
111
111
|
if (this._useConpty) {
|
|
112
|
-
var connect = this._ptyNative.connect(this._pty, commandLine, cwd, env, function (c) { return _this._$onProcessExit(c); });
|
|
112
|
+
var connect = this._ptyNative.connect(this._pty, commandLine, cwd, env, this._useConptyDll, function (c) { return _this._$onProcessExit(c); });
|
|
113
113
|
this._innerPid = connect.pid;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -155,21 +155,32 @@ var WindowsPtyAgent = /** @class */ (function () {
|
|
|
155
155
|
};
|
|
156
156
|
WindowsPtyAgent.prototype.kill = function () {
|
|
157
157
|
var _this = this;
|
|
158
|
-
this._inSocket.readable = false;
|
|
159
|
-
this._outSocket.readable = false;
|
|
160
158
|
// Tell the agent to kill the pty, this releases handles to the process
|
|
161
159
|
if (this._useConpty) {
|
|
162
|
-
this.
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
160
|
+
if (!this._useConptyDll) {
|
|
161
|
+
this._inSocket.readable = false;
|
|
162
|
+
this._outSocket.readable = false;
|
|
163
|
+
this._getConsoleProcessList().then(function (consoleProcessList) {
|
|
164
|
+
consoleProcessList.forEach(function (pid) {
|
|
165
|
+
try {
|
|
166
|
+
process.kill(pid);
|
|
167
|
+
}
|
|
168
|
+
catch (e) {
|
|
169
|
+
// Ignore if process cannot be found (kill ESRCH error)
|
|
170
|
+
}
|
|
171
|
+
});
|
|
170
172
|
});
|
|
171
|
-
|
|
172
|
-
|
|
173
|
+
this._ptyNative.kill(this._pty, this._useConptyDll);
|
|
174
|
+
this._conoutSocketWorker.dispose();
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
// Close the input write handle to signal the end of session.
|
|
178
|
+
this._inSocket.destroy();
|
|
179
|
+
this._ptyNative.kill(this._pty, this._useConptyDll);
|
|
180
|
+
this._outSocket.on('data', function () {
|
|
181
|
+
_this._conoutSocketWorker.dispose();
|
|
182
|
+
});
|
|
183
|
+
}
|
|
173
184
|
}
|
|
174
185
|
else {
|
|
175
186
|
// Because pty.kill closes the handle, it will kill most processes by itself.
|
|
@@ -189,7 +200,6 @@ var WindowsPtyAgent = /** @class */ (function () {
|
|
|
189
200
|
}
|
|
190
201
|
});
|
|
191
202
|
}
|
|
192
|
-
this._conoutSocketWorker.dispose();
|
|
193
203
|
};
|
|
194
204
|
WindowsPtyAgent.prototype._getConsoleProcessList = function () {
|
|
195
205
|
var _this = this;
|
|
@@ -234,17 +244,25 @@ var WindowsPtyAgent = /** @class */ (function () {
|
|
|
234
244
|
WindowsPtyAgent.prototype._$onProcessExit = function (exitCode) {
|
|
235
245
|
var _this = this;
|
|
236
246
|
this._exitCode = exitCode;
|
|
237
|
-
this.
|
|
238
|
-
|
|
247
|
+
if (!this._useConptyDll) {
|
|
248
|
+
this._flushDataAndCleanUp();
|
|
249
|
+
this._outSocket.on('data', function () { return _this._flushDataAndCleanUp(); });
|
|
250
|
+
}
|
|
239
251
|
};
|
|
240
252
|
WindowsPtyAgent.prototype._flushDataAndCleanUp = function () {
|
|
241
253
|
var _this = this;
|
|
254
|
+
if (this._useConptyDll) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
242
257
|
if (this._closeTimeout) {
|
|
243
258
|
clearTimeout(this._closeTimeout);
|
|
244
259
|
}
|
|
245
260
|
this._closeTimeout = setTimeout(function () { return _this._cleanUpProcess(); }, FLUSH_DATA_INTERVAL);
|
|
246
261
|
};
|
|
247
262
|
WindowsPtyAgent.prototype._cleanUpProcess = function () {
|
|
263
|
+
if (this._useConptyDll) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
248
266
|
this._inSocket.readable = false;
|
|
249
267
|
this._outSocket.readable = false;
|
|
250
268
|
this._outSocket.destroy();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"windowsPtyAgent.js","sourceRoot":"","sources":["../src/windowsPtyAgent.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,uBAAyB;AACzB,uBAAyB;AACzB,2BAA6B;AAC7B
|
|
1
|
+
{"version":3,"file":"windowsPtyAgent.js","sourceRoot":"","sources":["../src/windowsPtyAgent.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,uBAAyB;AACzB,uBAAyB;AACzB,2BAA6B;AAC7B,+CAAqC;AACrC,2BAA6B;AAE7B,qEAA6D;AAE7D,IAAI,YAA2B,CAAC;AAChC,IAAI,YAA2B,CAAC;AAEhC;;;;GAIG;AACH,IAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC;;;GAGG;AACH;IAmBE,yBACE,IAAY,EACZ,IAAuB,EACvB,GAAa,EACb,GAAW,EACX,IAAY,EACZ,IAAY,EACZ,KA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AAM,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBACpC,OAAO,GAAG,CAAC,CAAC;gBACZ,MAAM,IAAI,CAAC,CAAC;aACb;SACF;QACD,IAAI,KAAK,EAAE;YACT,MAAM,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC;YACxC,MAAM,IAAI,IAAI,CAAC;SAChB;aAAM;YACL,MAAM,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SACrC;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAlDD,8CAkDC;AAED,SAAS,aAAa,CAAC,IAAuB;IAC5C,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC;AAClC,CAAC;AAED,SAAS,UAAU,CAAC,IAAY,EAAE,KAAa;IAC7C,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;QAC9B,MAAM,IAAI,IAAI,CAAC;KAChB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,GAAG,CAAC,IAAa,EAAE,IAAa;IACvC,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -18,14 +18,17 @@ function pollForProcessState(desiredState, intervalMs, timeoutMs) {
|
|
|
18
18
|
psList({ all: true }).then(function (ps) {
|
|
19
19
|
var success = true;
|
|
20
20
|
var pids = Object.keys(desiredState).map(function (k) { return parseInt(k, 10); });
|
|
21
|
+
console.log('expected pids', JSON.stringify(pids));
|
|
21
22
|
pids.forEach(function (pid) {
|
|
22
23
|
if (desiredState[pid]) {
|
|
23
24
|
if (!ps.some(function (p) { return p.pid === pid; })) {
|
|
25
|
+
console.log("pid " + pid + " does not exist");
|
|
24
26
|
success = false;
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
else {
|
|
28
30
|
if (ps.some(function (p) { return p.pid === pid; })) {
|
|
31
|
+
console.log("pid " + pid + " still exists");
|
|
29
32
|
success = false;
|
|
30
33
|
}
|
|
31
34
|
}
|
|
@@ -68,6 +71,7 @@ function pollForProcessTreeSize(pid, size, intervalMs, timeoutMs) {
|
|
|
68
71
|
while (openList.length) {
|
|
69
72
|
_loop_1();
|
|
70
73
|
}
|
|
74
|
+
console.log('list', JSON.stringify(list));
|
|
71
75
|
var success = list.length === size;
|
|
72
76
|
if (success) {
|
|
73
77
|
clearInterval(interval);
|
|
@@ -84,50 +88,53 @@ function pollForProcessTreeSize(pid, size, intervalMs, timeoutMs) {
|
|
|
84
88
|
});
|
|
85
89
|
}
|
|
86
90
|
if (process.platform === 'win32') {
|
|
87
|
-
[true, false].forEach(function (
|
|
88
|
-
|
|
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 () {
|
|
89
94
|
describe('kill', function () {
|
|
90
95
|
it('should not crash parent process', function (done) {
|
|
91
|
-
|
|
96
|
+
this.timeout(20000);
|
|
97
|
+
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], { useConpty: useConpty, useConptyDll: useConptyDll });
|
|
98
|
+
term.on('exit', function () { return done(); });
|
|
92
99
|
term.kill();
|
|
93
|
-
// Add done call to deferred function queue to ensure the kill call has completed
|
|
94
|
-
term._defer(done);
|
|
95
100
|
});
|
|
96
101
|
it('should kill the process tree', function (done) {
|
|
97
|
-
this.timeout(
|
|
98
|
-
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], { useConpty: useConpty });
|
|
102
|
+
this.timeout(20000);
|
|
103
|
+
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], { useConpty: useConpty, useConptyDll: useConptyDll });
|
|
99
104
|
// Start sub-processes
|
|
100
105
|
term.write('powershell.exe\r');
|
|
101
|
-
term.write('notepad.exe\r');
|
|
102
106
|
term.write('node.exe\r');
|
|
103
|
-
|
|
107
|
+
console.log('start poll for tree size');
|
|
108
|
+
pollForProcessTreeSize(term.pid, 3, 500, 5000).then(function (list) {
|
|
104
109
|
assert.strictEqual(list[0].name.toLowerCase(), 'cmd.exe');
|
|
105
110
|
assert.strictEqual(list[1].name.toLowerCase(), 'powershell.exe');
|
|
106
|
-
assert.strictEqual(list[2].name.toLowerCase(), '
|
|
107
|
-
assert.strictEqual(list[3].name.toLowerCase(), 'node.exe');
|
|
111
|
+
assert.strictEqual(list[2].name.toLowerCase(), 'node.exe');
|
|
108
112
|
term.kill();
|
|
109
113
|
var desiredState = {};
|
|
110
114
|
desiredState[list[0].pid] = false;
|
|
111
115
|
desiredState[list[1].pid] = false;
|
|
112
|
-
desiredState[list[2].pid] =
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
done();
|
|
116
|
+
desiredState[list[2].pid] = false;
|
|
117
|
+
term.on('exit', function () {
|
|
118
|
+
pollForProcessState(desiredState, 1000, 5000).then(function () {
|
|
119
|
+
done();
|
|
120
|
+
});
|
|
118
121
|
});
|
|
119
122
|
});
|
|
120
123
|
});
|
|
121
124
|
});
|
|
122
125
|
describe('resize', function () {
|
|
123
|
-
it('should throw a non-native exception when resizing an invalid value', function () {
|
|
124
|
-
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], { useConpty: useConpty });
|
|
126
|
+
it('should throw a non-native exception when resizing an invalid value', function (done) {
|
|
127
|
+
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], { useConpty: useConpty, useConptyDll: useConptyDll });
|
|
125
128
|
assert.throws(function () { return term.resize(-1, -1); });
|
|
126
129
|
assert.throws(function () { return term.resize(0, 0); });
|
|
127
130
|
assert.doesNotThrow(function () { return term.resize(1, 1); });
|
|
131
|
+
term.on('exit', function () {
|
|
132
|
+
done();
|
|
133
|
+
});
|
|
134
|
+
term.kill();
|
|
128
135
|
});
|
|
129
136
|
it('should throw a non-native exception when resizing a killed terminal', function (done) {
|
|
130
|
-
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], { useConpty: useConpty });
|
|
137
|
+
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], { useConpty: useConpty, useConptyDll: useConptyDll });
|
|
131
138
|
term._defer(function () {
|
|
132
139
|
term.once('exit', function () {
|
|
133
140
|
assert.throws(function () { return term.resize(1, 1); });
|
|
@@ -139,6 +146,7 @@ if (process.platform === 'win32') {
|
|
|
139
146
|
});
|
|
140
147
|
describe('Args as CommandLine', function () {
|
|
141
148
|
it('should not fail running a file containing a space in the path', function (done) {
|
|
149
|
+
this.timeout(10000);
|
|
142
150
|
var spaceFolder = path.resolve(__dirname, '..', 'fixtures', 'space folder');
|
|
143
151
|
if (!fs.existsSync(spaceFolder)) {
|
|
144
152
|
fs.mkdirSync(spaceFolder);
|
|
@@ -150,7 +158,7 @@ if (process.platform === 'win32') {
|
|
|
150
158
|
// Skip test if git bash isn't installed
|
|
151
159
|
return;
|
|
152
160
|
}
|
|
153
|
-
var term = new windowsTerminal_1.WindowsTerminal(cmdCopiedPath, '/c echo "hello world"', { useConpty: useConpty });
|
|
161
|
+
var term = new windowsTerminal_1.WindowsTerminal(cmdCopiedPath, '/c echo "hello world"', { useConpty: useConpty, useConptyDll: useConptyDll });
|
|
154
162
|
var result = '';
|
|
155
163
|
term.on('data', function (data) {
|
|
156
164
|
result += data;
|
|
@@ -163,7 +171,8 @@ if (process.platform === 'win32') {
|
|
|
163
171
|
});
|
|
164
172
|
describe('env', function () {
|
|
165
173
|
it('should set environment variables of the shell', function (done) {
|
|
166
|
-
|
|
174
|
+
this.timeout(10000);
|
|
175
|
+
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '/C echo %FOO%', { useConpty: useConpty, useConptyDll: useConptyDll, env: { FOO: 'BAR' } });
|
|
167
176
|
var result = '';
|
|
168
177
|
term.on('data', function (data) {
|
|
169
178
|
result += data;
|
|
@@ -176,14 +185,16 @@ if (process.platform === 'win32') {
|
|
|
176
185
|
});
|
|
177
186
|
describe('On close', function () {
|
|
178
187
|
it('should return process zero exit codes', function (done) {
|
|
179
|
-
|
|
188
|
+
this.timeout(10000);
|
|
189
|
+
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '/C exit', { useConpty: useConpty, useConptyDll: useConptyDll });
|
|
180
190
|
term.on('exit', function (code) {
|
|
181
191
|
assert.strictEqual(code, 0);
|
|
182
192
|
done();
|
|
183
193
|
});
|
|
184
194
|
});
|
|
185
195
|
it('should return process non-zero exit codes', function (done) {
|
|
186
|
-
|
|
196
|
+
this.timeout(10000);
|
|
197
|
+
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '/C exit 2', { useConpty: useConpty, useConptyDll: useConptyDll });
|
|
187
198
|
term.on('exit', function (code) {
|
|
188
199
|
assert.strictEqual(code, 2);
|
|
189
200
|
done();
|
|
@@ -192,7 +203,8 @@ if (process.platform === 'win32') {
|
|
|
192
203
|
});
|
|
193
204
|
describe('Write', function () {
|
|
194
205
|
it('should accept input', function (done) {
|
|
195
|
-
|
|
206
|
+
this.timeout(10000);
|
|
207
|
+
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '', { useConpty: useConpty, useConptyDll: useConptyDll });
|
|
196
208
|
term.write('exit\r');
|
|
197
209
|
term.on('exit', function () {
|
|
198
210
|
done();
|
|
@@ -1 +1 @@
|
|
|
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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CAAC,CAAC;CACJ"}
|
|
@@ -5,18 +5,21 @@
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
var worker_threads_1 = require("worker_threads");
|
|
7
7
|
var net_1 = require("net");
|
|
8
|
+
var fs = require("fs");
|
|
8
9
|
var conout_1 = require("../shared/conout");
|
|
9
10
|
var conoutPipeName = worker_threads_1.workerData.conoutPipeName;
|
|
10
|
-
var
|
|
11
|
+
var outSocketFD = fs.openSync(conoutPipeName, 'r');
|
|
12
|
+
var conoutSocket = new net_1.Socket({
|
|
13
|
+
fd: outSocketFD,
|
|
14
|
+
readable: true
|
|
15
|
+
});
|
|
11
16
|
conoutSocket.setEncoding('utf8');
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
conoutSocket.pipe(workerSocket);
|
|
15
|
-
});
|
|
16
|
-
server.listen(conout_1.getWorkerPipeName(conoutPipeName));
|
|
17
|
-
if (!worker_threads_1.parentPort) {
|
|
18
|
-
throw new Error('worker_threads parentPort is null');
|
|
19
|
-
}
|
|
20
|
-
worker_threads_1.parentPort.postMessage(1 /* READY */);
|
|
17
|
+
var server = net_1.createServer(function (workerSocket) {
|
|
18
|
+
conoutSocket.pipe(workerSocket);
|
|
21
19
|
});
|
|
20
|
+
server.listen(conout_1.getWorkerPipeName(conoutPipeName));
|
|
21
|
+
if (!worker_threads_1.parentPort) {
|
|
22
|
+
throw new Error('worker_threads parentPort is null');
|
|
23
|
+
}
|
|
24
|
+
worker_threads_1.parentPort.postMessage(1 /* READY */);
|
|
22
25
|
//# sourceMappingURL=conoutSocketWorker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conoutSocketWorker.js","sourceRoot":"","sources":["../../src/worker/conoutSocketWorker.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,iDAAwD;AACxD,2BAA2C;AAC3C,2CAAuF;AAEvF,IAAM,cAAc,GAAI,2BAA0B,CAAC,cAAc,CAAC;AAClE,IAAM,
|
|
1
|
+
{"version":3,"file":"conoutSocketWorker.js","sourceRoot":"","sources":["../../src/worker/conoutSocketWorker.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,iDAAwD;AACxD,2BAA2C;AAC3C,uBAAyB;AACzB,2CAAuF;AAEvF,IAAM,cAAc,GAAI,2BAA0B,CAAC,cAAc,CAAC;AAClE,IAAM,WAAW,GAAG,EAAE,CAAC,QAAQ,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;AACrD,IAAM,YAAY,GAAG,IAAI,YAAM,CAAC;IAC9B,EAAE,EAAE,WAAW;IACf,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC;AACH,YAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AACjC,IAAM,MAAM,GAAG,kBAAY,CAAC,UAAA,YAAY;IACtC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AAClC,CAAC,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,CAAC,0BAAiB,CAAC,cAAc,CAAC,CAAC,CAAC;AAEjD,IAAI,CAAC,2BAAU,EAAE;IACf,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;CACtD;AACD,2BAAU,CAAC,WAAW,eAA2B,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
}
|
package/scripts/publish.js
CHANGED
|
@@ -12,11 +12,11 @@ fs.writeFileSync(`${process.env['HOME']}/.npmrc`, `//registry.npmjs.org/:_authTo
|
|
|
12
12
|
|
|
13
13
|
// Determine if this is a stable or beta release
|
|
14
14
|
const publishedVersions = getPublishedVersions();
|
|
15
|
-
const isStableRelease = publishedVersions.
|
|
15
|
+
const isStableRelease = !publishedVersions.includes(packageJson.version);
|
|
16
16
|
|
|
17
17
|
// Get the next version
|
|
18
|
-
|
|
19
|
-
console.log(`
|
|
18
|
+
const nextVersion = isStableRelease ? packageJson.version : getNextBetaVersion();
|
|
19
|
+
console.log(`Setting version to ${nextVersion}`);
|
|
20
20
|
|
|
21
21
|
// Set the version in package.json
|
|
22
22
|
const packageJsonFile = path.resolve(__dirname, '..', 'package.json');
|
|
@@ -53,7 +53,10 @@ function getNextBetaVersion() {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
function getPublishedVersions(version, tag) {
|
|
56
|
-
const
|
|
56
|
+
const isWin32 = process.platform === 'win32';
|
|
57
|
+
const versionsProcess = isWin32 ?
|
|
58
|
+
cp.spawnSync('npm.cmd', ['view', packageJson.name, 'versions', '--json'], { shell: true }) :
|
|
59
|
+
cp.spawnSync('npm', ['view', packageJson.name, 'versions', '--json']);
|
|
57
60
|
const versionsJson = JSON.parse(versionsProcess.stdout);
|
|
58
61
|
if (tag) {
|
|
59
62
|
return versionsJson.filter(v => !v.search(new RegExp(`${version}-${tag}[0-9]+`)));
|
package/src/native.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
interface IConptyNative {
|
|
6
6
|
startProcess(file: string, cols: number, rows: number, debug: boolean, pipeName: string, conptyInheritCursor: boolean, useConptyDll: boolean): IConptyProcess;
|
|
7
|
-
connect(ptyId: number, commandLine: string, cwd: string, env: string[], onExitCallback: (exitCode: number) => void): { pid: number };
|
|
7
|
+
connect(ptyId: number, commandLine: string, cwd: string, env: string[], useConptyDll: boolean, onExitCallback: (exitCode: number) => void): { pid: number };
|
|
8
8
|
resize(ptyId: number, cols: number, rows: number, useConptyDll: boolean): void;
|
|
9
9
|
clear(ptyId: number, useConptyDll: boolean): void;
|
|
10
10
|
kill(ptyId: number, useConptyDll: boolean): void;
|
package/src/win/conpty.cc
CHANGED
|
@@ -34,6 +34,7 @@ typedef HRESULT (__stdcall *PFNCREATEPSEUDOCONSOLE)(COORD c, HANDLE hIn, HANDLE
|
|
|
34
34
|
typedef HRESULT (__stdcall *PFNRESIZEPSEUDOCONSOLE)(HPCON hpc, COORD newSize);
|
|
35
35
|
typedef HRESULT (__stdcall *PFNCLEARPSEUDOCONSOLE)(HPCON hpc);
|
|
36
36
|
typedef void (__stdcall *PFNCLOSEPSEUDOCONSOLE)(HPCON hpc);
|
|
37
|
+
typedef void (__stdcall *PFNRELEASEPSEUDOCONSOLE)(HPCON hpc);
|
|
37
38
|
|
|
38
39
|
#endif
|
|
39
40
|
|
|
@@ -48,27 +49,26 @@ struct pty_baton {
|
|
|
48
49
|
pty_baton(int _id, HANDLE _hIn, HANDLE _hOut, HPCON _hpc) : id(_id), hIn(_hIn), hOut(_hOut), hpc(_hpc) {};
|
|
49
50
|
};
|
|
50
51
|
|
|
51
|
-
static std::vector<pty_baton
|
|
52
|
+
static std::vector<std::unique_ptr<pty_baton>> ptyHandles;
|
|
52
53
|
static volatile LONG ptyCounter;
|
|
53
54
|
|
|
54
55
|
static pty_baton* get_pty_baton(int id) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
auto it = std::find_if(ptyHandles.begin(), ptyHandles.end(), [id](const auto& ptyHandle) {
|
|
57
|
+
return ptyHandle->id == id;
|
|
58
|
+
});
|
|
59
|
+
if (it != ptyHandles.end()) {
|
|
60
|
+
return it->get();
|
|
60
61
|
}
|
|
61
62
|
return nullptr;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
static bool remove_pty_baton(int id) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
66
|
+
auto it = std::remove_if(ptyHandles.begin(), ptyHandles.end(), [id](const auto& ptyHandle) {
|
|
67
|
+
return ptyHandle->id == id;
|
|
68
|
+
});
|
|
69
|
+
if (it != ptyHandles.end()) {
|
|
70
|
+
ptyHandles.erase(it);
|
|
71
|
+
return true;
|
|
72
72
|
}
|
|
73
73
|
return false;
|
|
74
74
|
}
|
|
@@ -102,11 +102,8 @@ void SetupExitCallback(Napi::Env env, Napi::Function cb, pty_baton* baton) {
|
|
|
102
102
|
// Get process exit code.
|
|
103
103
|
GetExitCodeProcess(baton->hShell, (LPDWORD)(&exit_event->exit_code));
|
|
104
104
|
// Clean up handles
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
// so we only call CloseHandle for now.
|
|
108
|
-
CloseHandle(baton->hIn);
|
|
109
|
-
CloseHandle(baton->hOut);
|
|
105
|
+
CloseHandle(baton->hShell);
|
|
106
|
+
assert(remove_pty_baton(baton->id));
|
|
110
107
|
|
|
111
108
|
auto status = tsfn.BlockingCall(exit_event, callback); // In main thread
|
|
112
109
|
switch (status) {
|
|
@@ -304,7 +301,8 @@ static Napi::Value PtyStartProcess(const Napi::CallbackInfo& info) {
|
|
|
304
301
|
// We were able to instantiate a conpty
|
|
305
302
|
const int ptyId = InterlockedIncrement(&ptyCounter);
|
|
306
303
|
marshal.Set("pty", Napi::Number::New(env, ptyId));
|
|
307
|
-
ptyHandles.
|
|
304
|
+
ptyHandles.emplace_back(
|
|
305
|
+
std::make_unique<pty_baton>(ptyId, hIn, hOut, hpc));
|
|
308
306
|
} else {
|
|
309
307
|
throw Napi::Error::New(env, "Cannot launch conpty");
|
|
310
308
|
}
|
|
@@ -335,20 +333,22 @@ static Napi::Value PtyConnect(const Napi::CallbackInfo& info) {
|
|
|
335
333
|
std::stringstream errorText;
|
|
336
334
|
BOOL fSuccess = FALSE;
|
|
337
335
|
|
|
338
|
-
if (info.Length() !=
|
|
336
|
+
if (info.Length() != 6 ||
|
|
339
337
|
!info[0].IsNumber() ||
|
|
340
338
|
!info[1].IsString() ||
|
|
341
339
|
!info[2].IsString() ||
|
|
342
340
|
!info[3].IsArray() ||
|
|
343
|
-
!info[4].
|
|
344
|
-
|
|
341
|
+
!info[4].IsBoolean() ||
|
|
342
|
+
!info[5].IsFunction()) {
|
|
343
|
+
throw Napi::Error::New(env, "Usage: pty.connect(id, cmdline, cwd, env, useConptyDll, exitCallback)");
|
|
345
344
|
}
|
|
346
345
|
|
|
347
346
|
const int id = info[0].As<Napi::Number>().Int32Value();
|
|
348
347
|
const std::wstring cmdline(path_util::to_wstring(info[1].As<Napi::String>()));
|
|
349
348
|
const std::wstring cwd(path_util::to_wstring(info[2].As<Napi::String>()));
|
|
350
349
|
const Napi::Array envValues = info[3].As<Napi::Array>();
|
|
351
|
-
|
|
350
|
+
const bool useConptyDll = info[4].As<Napi::Boolean>().Value();
|
|
351
|
+
Napi::Function exitCallback = info[5].As<Napi::Function>();
|
|
352
352
|
|
|
353
353
|
// Fetch pty handle from ID and start process
|
|
354
354
|
pty_baton* handle = get_pty_baton(id);
|
|
@@ -426,11 +426,26 @@ static Napi::Value PtyConnect(const Napi::CallbackInfo& info) {
|
|
|
426
426
|
throw errorWithCode(info, "Cannot create process");
|
|
427
427
|
}
|
|
428
428
|
|
|
429
|
+
HANDLE hLibrary = LoadConptyDll(info, useConptyDll);
|
|
430
|
+
bool fLoadedDll = hLibrary != nullptr;
|
|
431
|
+
if (fLoadedDll)
|
|
432
|
+
{
|
|
433
|
+
PFNRELEASEPSEUDOCONSOLE const pfnReleasePseudoConsole = (PFNRELEASEPSEUDOCONSOLE)GetProcAddress(
|
|
434
|
+
(HMODULE)hLibrary, "ConptyReleasePseudoConsole");
|
|
435
|
+
if (pfnReleasePseudoConsole)
|
|
436
|
+
{
|
|
437
|
+
pfnReleasePseudoConsole(handle->hpc);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
429
441
|
// Update handle
|
|
430
442
|
handle->hShell = piClient.hProcess;
|
|
431
443
|
|
|
432
444
|
// Close the thread handle to avoid resource leak
|
|
433
445
|
CloseHandle(piClient.hThread);
|
|
446
|
+
// Close the input read and output write handle of the pseudoconsole
|
|
447
|
+
CloseHandle(handle->hIn);
|
|
448
|
+
CloseHandle(handle->hOut);
|
|
434
449
|
|
|
435
450
|
SetupExitCallback(env, exitCallback, handle);
|
|
436
451
|
|
|
@@ -544,9 +559,7 @@ static Napi::Value PtyKill(const Napi::CallbackInfo& info) {
|
|
|
544
559
|
pfnClosePseudoConsole(handle->hpc);
|
|
545
560
|
}
|
|
546
561
|
}
|
|
547
|
-
|
|
548
|
-
CloseHandle(handle->hShell);
|
|
549
|
-
assert(remove_pty_baton(id));
|
|
562
|
+
TerminateProcess(handle->hShell, 1);
|
|
550
563
|
}
|
|
551
564
|
|
|
552
565
|
return env.Undefined();
|
package/src/windowsPtyAgent.ts
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
import * as fs from 'fs';
|
|
8
8
|
import * as os from 'os';
|
|
9
9
|
import * as path from 'path';
|
|
10
|
+
import { fork } from 'child_process';
|
|
10
11
|
import { Socket } from 'net';
|
|
11
12
|
import { ArgvOrCommandLine } from './types';
|
|
12
|
-
import { fork } from 'child_process';
|
|
13
13
|
import { ConoutConnection } from './windowsConoutConnection';
|
|
14
14
|
|
|
15
15
|
let conptyNative: IConptyNative;
|
|
@@ -135,7 +135,7 @@ export class WindowsPtyAgent {
|
|
|
135
135
|
this._inSocket.setEncoding('utf8');
|
|
136
136
|
|
|
137
137
|
if (this._useConpty) {
|
|
138
|
-
const connect = (this._ptyNative as IConptyNative).connect(this._pty, commandLine, cwd, env, c => this._$onProcessExit(c));
|
|
138
|
+
const connect = (this._ptyNative as IConptyNative).connect(this._pty, commandLine, cwd, env, this._useConptyDll, c => this._$onProcessExit(c));
|
|
139
139
|
this._innerPid = connect.pid;
|
|
140
140
|
}
|
|
141
141
|
}
|
|
@@ -158,20 +158,30 @@ export class WindowsPtyAgent {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
public kill(): void {
|
|
161
|
-
this._inSocket.readable = false;
|
|
162
|
-
this._outSocket.readable = false;
|
|
163
161
|
// Tell the agent to kill the pty, this releases handles to the process
|
|
164
162
|
if (this._useConpty) {
|
|
165
|
-
this.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
163
|
+
if (!this._useConptyDll) {
|
|
164
|
+
this._inSocket.readable = false;
|
|
165
|
+
this._outSocket.readable = false;
|
|
166
|
+
this._getConsoleProcessList().then(consoleProcessList => {
|
|
167
|
+
consoleProcessList.forEach((pid: number) => {
|
|
168
|
+
try {
|
|
169
|
+
process.kill(pid);
|
|
170
|
+
} catch (e) {
|
|
171
|
+
// Ignore if process cannot be found (kill ESRCH error)
|
|
172
|
+
}
|
|
173
|
+
});
|
|
172
174
|
});
|
|
173
175
|
(this._ptyNative as IConptyNative).kill(this._pty, this._useConptyDll);
|
|
174
|
-
|
|
176
|
+
this._conoutSocketWorker.dispose();
|
|
177
|
+
} else {
|
|
178
|
+
// Close the input write handle to signal the end of session.
|
|
179
|
+
this._inSocket.destroy();
|
|
180
|
+
(this._ptyNative as IConptyNative).kill(this._pty, this._useConptyDll);
|
|
181
|
+
this._outSocket.on('data', () => {
|
|
182
|
+
this._conoutSocketWorker.dispose();
|
|
183
|
+
});
|
|
184
|
+
}
|
|
175
185
|
} else {
|
|
176
186
|
// Because pty.kill closes the handle, it will kill most processes by itself.
|
|
177
187
|
// Process IDs can be reused as soon as all handles to them are
|
|
@@ -189,7 +199,6 @@ export class WindowsPtyAgent {
|
|
|
189
199
|
}
|
|
190
200
|
});
|
|
191
201
|
}
|
|
192
|
-
this._conoutSocketWorker.dispose();
|
|
193
202
|
}
|
|
194
203
|
|
|
195
204
|
private _getConsoleProcessList(): Promise<number[]> {
|
|
@@ -233,11 +242,16 @@ export class WindowsPtyAgent {
|
|
|
233
242
|
*/
|
|
234
243
|
private _$onProcessExit(exitCode: number): void {
|
|
235
244
|
this._exitCode = exitCode;
|
|
236
|
-
this.
|
|
237
|
-
|
|
245
|
+
if (!this._useConptyDll) {
|
|
246
|
+
this._flushDataAndCleanUp();
|
|
247
|
+
this._outSocket.on('data', () => this._flushDataAndCleanUp());
|
|
248
|
+
}
|
|
238
249
|
}
|
|
239
250
|
|
|
240
251
|
private _flushDataAndCleanUp(): void {
|
|
252
|
+
if (this._useConptyDll) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
241
255
|
if (this._closeTimeout) {
|
|
242
256
|
clearTimeout(this._closeTimeout);
|
|
243
257
|
}
|
|
@@ -245,6 +259,9 @@ export class WindowsPtyAgent {
|
|
|
245
259
|
}
|
|
246
260
|
|
|
247
261
|
private _cleanUpProcess(): void {
|
|
262
|
+
if (this._useConptyDll) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
248
265
|
this._inSocket.readable = false;
|
|
249
266
|
this._outSocket.readable = false;
|
|
250
267
|
this._outSocket.destroy();
|
|
@@ -26,13 +26,16 @@ function pollForProcessState(desiredState: IProcessState, intervalMs: number = 1
|
|
|
26
26
|
psList({ all: true }).then(ps => {
|
|
27
27
|
let success = true;
|
|
28
28
|
const pids = Object.keys(desiredState).map(k => parseInt(k, 10));
|
|
29
|
+
console.log('expected pids', JSON.stringify(pids));
|
|
29
30
|
pids.forEach(pid => {
|
|
30
31
|
if (desiredState[pid]) {
|
|
31
32
|
if (!ps.some(p => p.pid === pid)) {
|
|
33
|
+
console.log(`pid ${pid} does not exist`);
|
|
32
34
|
success = false;
|
|
33
35
|
}
|
|
34
36
|
} else {
|
|
35
37
|
if (ps.some(p => p.pid === pid)) {
|
|
38
|
+
console.log(`pid ${pid} still exists`);
|
|
36
39
|
success = false;
|
|
37
40
|
}
|
|
38
41
|
}
|
|
@@ -71,6 +74,7 @@ function pollForProcessTreeSize(pid: number, size: number, intervalMs: number =
|
|
|
71
74
|
}).forEach(p => openList.push(p));
|
|
72
75
|
list.push(current);
|
|
73
76
|
}
|
|
77
|
+
console.log('list', JSON.stringify(list));
|
|
74
78
|
const success = list.length === size;
|
|
75
79
|
if (success) {
|
|
76
80
|
clearInterval(interval);
|
|
@@ -88,51 +92,53 @@ function pollForProcessTreeSize(pid: number, size: number, intervalMs: number =
|
|
|
88
92
|
}
|
|
89
93
|
|
|
90
94
|
if (process.platform === 'win32') {
|
|
91
|
-
[true, false].forEach((useConpty) => {
|
|
92
|
-
describe(`WindowsTerminal (useConpty = ${useConpty})`, () => {
|
|
95
|
+
[[false, false], [true, false], [true, true]].forEach(([useConpty, useConptyDll]) => {
|
|
96
|
+
describe(`WindowsTerminal (useConpty = ${useConpty}, useConptyDll = ${useConptyDll})`, () => {
|
|
93
97
|
describe('kill', () => {
|
|
94
|
-
it('should not crash parent process', (done)
|
|
95
|
-
|
|
98
|
+
it('should not crash parent process', function (done) {
|
|
99
|
+
this.timeout(20000);
|
|
100
|
+
const term = new WindowsTerminal('cmd.exe', [], { useConpty, useConptyDll });
|
|
101
|
+
term.on('exit', () => done());
|
|
96
102
|
term.kill();
|
|
97
|
-
// Add done call to deferred function queue to ensure the kill call has completed
|
|
98
|
-
(<any>term)._defer(done);
|
|
99
103
|
});
|
|
100
104
|
it('should kill the process tree', function (done: Mocha.Done): void {
|
|
101
|
-
this.timeout(
|
|
102
|
-
const term = new WindowsTerminal('cmd.exe', [], { useConpty });
|
|
105
|
+
this.timeout(20000);
|
|
106
|
+
const term = new WindowsTerminal('cmd.exe', [], { useConpty, useConptyDll });
|
|
103
107
|
// Start sub-processes
|
|
104
108
|
term.write('powershell.exe\r');
|
|
105
|
-
term.write('notepad.exe\r');
|
|
106
109
|
term.write('node.exe\r');
|
|
107
|
-
|
|
110
|
+
console.log('start poll for tree size');
|
|
111
|
+
pollForProcessTreeSize(term.pid, 3, 500, 5000).then(list => {
|
|
108
112
|
assert.strictEqual(list[0].name.toLowerCase(), 'cmd.exe');
|
|
109
113
|
assert.strictEqual(list[1].name.toLowerCase(), 'powershell.exe');
|
|
110
|
-
assert.strictEqual(list[2].name.toLowerCase(), '
|
|
111
|
-
assert.strictEqual(list[3].name.toLowerCase(), 'node.exe');
|
|
114
|
+
assert.strictEqual(list[2].name.toLowerCase(), 'node.exe');
|
|
112
115
|
term.kill();
|
|
113
116
|
const desiredState: IProcessState = {};
|
|
114
117
|
desiredState[list[0].pid] = false;
|
|
115
118
|
desiredState[list[1].pid] = false;
|
|
116
|
-
desiredState[list[2].pid] =
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
done();
|
|
119
|
+
desiredState[list[2].pid] = false;
|
|
120
|
+
term.on('exit', () => {
|
|
121
|
+
pollForProcessState(desiredState, 1000, 5000).then(() => {
|
|
122
|
+
done();
|
|
123
|
+
});
|
|
122
124
|
});
|
|
123
125
|
});
|
|
124
126
|
});
|
|
125
127
|
});
|
|
126
128
|
|
|
127
129
|
describe('resize', () => {
|
|
128
|
-
it('should throw a non-native exception when resizing an invalid value', () => {
|
|
129
|
-
const term = new WindowsTerminal('cmd.exe', [], { useConpty });
|
|
130
|
+
it('should throw a non-native exception when resizing an invalid value', (done) => {
|
|
131
|
+
const term = new WindowsTerminal('cmd.exe', [], { useConpty, useConptyDll });
|
|
130
132
|
assert.throws(() => term.resize(-1, -1));
|
|
131
133
|
assert.throws(() => term.resize(0, 0));
|
|
132
134
|
assert.doesNotThrow(() => term.resize(1, 1));
|
|
135
|
+
term.on('exit', () => {
|
|
136
|
+
done();
|
|
137
|
+
});
|
|
138
|
+
term.kill();
|
|
133
139
|
});
|
|
134
140
|
it('should throw a non-native exception when resizing a killed terminal', (done) => {
|
|
135
|
-
const term = new WindowsTerminal('cmd.exe', [], { useConpty });
|
|
141
|
+
const term = new WindowsTerminal('cmd.exe', [], { useConpty, useConptyDll });
|
|
136
142
|
(<any>term)._defer(() => {
|
|
137
143
|
term.once('exit', () => {
|
|
138
144
|
assert.throws(() => term.resize(1, 1));
|
|
@@ -144,7 +150,8 @@ if (process.platform === 'win32') {
|
|
|
144
150
|
});
|
|
145
151
|
|
|
146
152
|
describe('Args as CommandLine', () => {
|
|
147
|
-
it('should not fail running a file containing a space in the path', (done)
|
|
153
|
+
it('should not fail running a file containing a space in the path', function (done) {
|
|
154
|
+
this.timeout(10000);
|
|
148
155
|
const spaceFolder = path.resolve(__dirname, '..', 'fixtures', 'space folder');
|
|
149
156
|
if (!fs.existsSync(spaceFolder)) {
|
|
150
157
|
fs.mkdirSync(spaceFolder);
|
|
@@ -158,7 +165,7 @@ if (process.platform === 'win32') {
|
|
|
158
165
|
// Skip test if git bash isn't installed
|
|
159
166
|
return;
|
|
160
167
|
}
|
|
161
|
-
const term = new WindowsTerminal(cmdCopiedPath, '/c echo "hello world"', { useConpty });
|
|
168
|
+
const term = new WindowsTerminal(cmdCopiedPath, '/c echo "hello world"', { useConpty, useConptyDll });
|
|
162
169
|
let result = '';
|
|
163
170
|
term.on('data', (data) => {
|
|
164
171
|
result += data;
|
|
@@ -171,8 +178,9 @@ if (process.platform === 'win32') {
|
|
|
171
178
|
});
|
|
172
179
|
|
|
173
180
|
describe('env', () => {
|
|
174
|
-
it('should set environment variables of the shell', (done)
|
|
175
|
-
|
|
181
|
+
it('should set environment variables of the shell', function (done) {
|
|
182
|
+
this.timeout(10000);
|
|
183
|
+
const term = new WindowsTerminal('cmd.exe', '/C echo %FOO%', { useConpty, useConptyDll, env: { FOO: 'BAR' }});
|
|
176
184
|
let result = '';
|
|
177
185
|
term.on('data', (data) => {
|
|
178
186
|
result += data;
|
|
@@ -185,16 +193,18 @@ if (process.platform === 'win32') {
|
|
|
185
193
|
});
|
|
186
194
|
|
|
187
195
|
describe('On close', () => {
|
|
188
|
-
it('should return process zero exit codes', (done)
|
|
189
|
-
|
|
196
|
+
it('should return process zero exit codes', function (done) {
|
|
197
|
+
this.timeout(10000);
|
|
198
|
+
const term = new WindowsTerminal('cmd.exe', '/C exit', { useConpty, useConptyDll });
|
|
190
199
|
term.on('exit', (code) => {
|
|
191
200
|
assert.strictEqual(code, 0);
|
|
192
201
|
done();
|
|
193
202
|
});
|
|
194
203
|
});
|
|
195
204
|
|
|
196
|
-
it('should return process non-zero exit codes', (done)
|
|
197
|
-
|
|
205
|
+
it('should return process non-zero exit codes', function (done) {
|
|
206
|
+
this.timeout(10000);
|
|
207
|
+
const term = new WindowsTerminal('cmd.exe', '/C exit 2', { useConpty, useConptyDll });
|
|
198
208
|
term.on('exit', (code) => {
|
|
199
209
|
assert.strictEqual(code, 2);
|
|
200
210
|
done();
|
|
@@ -203,8 +213,9 @@ if (process.platform === 'win32') {
|
|
|
203
213
|
});
|
|
204
214
|
|
|
205
215
|
describe('Write', () => {
|
|
206
|
-
it('should accept input', (done)
|
|
207
|
-
|
|
216
|
+
it('should accept input', function (done) {
|
|
217
|
+
this.timeout(10000);
|
|
218
|
+
const term = new WindowsTerminal('cmd.exe', '', { useConpty, useConptyDll });
|
|
208
219
|
term.write('exit\r');
|
|
209
220
|
term.on('exit', () => {
|
|
210
221
|
done();
|
|
@@ -4,19 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
import { parentPort, workerData } from 'worker_threads';
|
|
6
6
|
import { Socket, createServer } from 'net';
|
|
7
|
+
import * as fs from 'fs';
|
|
7
8
|
import { ConoutWorkerMessage, IWorkerData, getWorkerPipeName } from '../shared/conout';
|
|
8
9
|
|
|
9
10
|
const conoutPipeName = (workerData as IWorkerData).conoutPipeName;
|
|
10
|
-
const
|
|
11
|
+
const outSocketFD = fs.openSync(conoutPipeName, 'r');
|
|
12
|
+
const conoutSocket = new Socket({
|
|
13
|
+
fd: outSocketFD,
|
|
14
|
+
readable: true
|
|
15
|
+
});
|
|
11
16
|
conoutSocket.setEncoding('utf8');
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
conoutSocket.pipe(workerSocket);
|
|
15
|
-
});
|
|
16
|
-
server.listen(getWorkerPipeName(conoutPipeName));
|
|
17
|
-
|
|
18
|
-
if (!parentPort) {
|
|
19
|
-
throw new Error('worker_threads parentPort is null');
|
|
20
|
-
}
|
|
21
|
-
parentPort.postMessage(ConoutWorkerMessage.READY);
|
|
17
|
+
const server = createServer(workerSocket => {
|
|
18
|
+
conoutSocket.pipe(workerSocket);
|
|
22
19
|
});
|
|
20
|
+
server.listen(getWorkerPipeName(conoutPipeName));
|
|
21
|
+
|
|
22
|
+
if (!parentPort) {
|
|
23
|
+
throw new Error('worker_threads parentPort is null');
|
|
24
|
+
}
|
|
25
|
+
parentPort.postMessage(ConoutWorkerMessage.READY);
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|