node-pty 1.1.0-beta3 → 1.1.0-beta30
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/README.md +6 -5
- package/binding.gyp +4 -15
- package/deps/winpty/src/agent/Agent.cc +11 -3
- package/lib/unixTerminal.js +4 -27
- package/lib/unixTerminal.js.map +1 -1
- package/lib/unixTerminal.test.js +3 -5
- package/lib/unixTerminal.test.js.map +1 -1
- package/lib/windowsConoutConnection.js +0 -4
- package/lib/windowsConoutConnection.js.map +1 -1
- package/lib/windowsPtyAgent.js +41 -21
- package/lib/windowsPtyAgent.js.map +1 -1
- package/lib/windowsTerminal.js +1 -1
- package/lib/windowsTerminal.js.map +1 -1
- package/lib/windowsTerminal.test.js +38 -26
- 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 +4 -2
- package/scripts/increment-version.js +54 -0
- package/scripts/post-install.js +51 -10
- package/scripts/publish.js +7 -4
- package/src/interfaces.ts +1 -0
- package/src/native.d.ts +5 -5
- package/src/unix/pty.cc +241 -284
- package/src/unixTerminal.test.ts +3 -6
- package/src/unixTerminal.ts +4 -18
- package/src/win/conpty.cc +264 -185
- package/src/win/conpty.h +41 -0
- package/src/win/conpty_console_list.cc +16 -15
- package/src/win/path_util.cc +39 -36
- package/src/win/path_util.h +5 -2
- package/src/win/winpty.cc +108 -151
- package/src/windowsConoutConnection.ts +0 -4
- package/src/windowsPtyAgent.ts +38 -20
- package/src/windowsTerminal.test.ts +43 -32
- package/src/windowsTerminal.ts +1 -1
- 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/typings/node-pty.d.ts +8 -0
package/src/unixTerminal.test.ts
CHANGED
|
@@ -272,10 +272,9 @@ if (process.platform !== 'win32') {
|
|
|
272
272
|
ptyProcess.on('data', function (data) {
|
|
273
273
|
if (ptyProcess.process === 'Python') {
|
|
274
274
|
console.log('title', ptyProcess.process);
|
|
275
|
+
console.log('ready', ptyProcess.pid);
|
|
275
276
|
}
|
|
276
277
|
});
|
|
277
|
-
setTimeout(() => null, 500);
|
|
278
|
-
console.log('ready', ptyProcess.pid);
|
|
279
278
|
`;
|
|
280
279
|
const p = cp.spawn('node', ['-e', data]);
|
|
281
280
|
let sub = '';
|
|
@@ -283,12 +282,10 @@ if (process.platform !== 'win32') {
|
|
|
283
282
|
p.stdout.on('data', (data) => {
|
|
284
283
|
if (!data.toString().indexOf('title')) {
|
|
285
284
|
sub = data.toString().split(' ')[1].slice(0, -1);
|
|
286
|
-
setTimeout(() => {
|
|
287
|
-
process.kill(parseInt(pid), 'SIGINT');
|
|
288
|
-
p.kill('SIGINT');
|
|
289
|
-
}, 200);
|
|
290
285
|
} else if (!data.toString().indexOf('ready')) {
|
|
291
286
|
pid = data.toString().split(' ')[1].slice(0, -1);
|
|
287
|
+
process.kill(parseInt(pid), 'SIGINT');
|
|
288
|
+
p.kill('SIGINT');
|
|
292
289
|
}
|
|
293
290
|
});
|
|
294
291
|
p.on('exit', () => {
|
package/src/unixTerminal.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import * as net from 'net';
|
|
7
7
|
import * as path from 'path';
|
|
8
|
+
import * as tty from 'tty';
|
|
8
9
|
import { Terminal, DEFAULT_COLS, DEFAULT_ROWS } from './terminal';
|
|
9
10
|
import { IProcessEnv, IPtyForkOptions, IPtyOpenOptions } from './interfaces';
|
|
10
11
|
import { ArgvOrCommandLine } from './types';
|
|
@@ -113,7 +114,7 @@ export class UnixTerminal extends Terminal {
|
|
|
113
114
|
// fork
|
|
114
115
|
const term = pty.fork(file, args, parsedEnv, cwd, this._cols, this._rows, uid, gid, (encoding === 'utf8'), helperPath, onexit);
|
|
115
116
|
|
|
116
|
-
this._socket = new
|
|
117
|
+
this._socket = new tty.ReadStream(term.fd);
|
|
117
118
|
if (encoding !== null) {
|
|
118
119
|
this._socket.setEncoding(encoding);
|
|
119
120
|
}
|
|
@@ -203,13 +204,13 @@ export class UnixTerminal extends Terminal {
|
|
|
203
204
|
// open
|
|
204
205
|
const term: IUnixOpenProcess = pty.open(cols, rows);
|
|
205
206
|
|
|
206
|
-
self._master = new
|
|
207
|
+
self._master = new tty.ReadStream(term.master);
|
|
207
208
|
if (encoding !== null) {
|
|
208
209
|
self._master.setEncoding(encoding);
|
|
209
210
|
}
|
|
210
211
|
self._master.resume();
|
|
211
212
|
|
|
212
|
-
self._slave = new
|
|
213
|
+
self._slave = new tty.ReadStream(term.slave);
|
|
213
214
|
if (encoding !== null) {
|
|
214
215
|
self._slave.setEncoding(encoding);
|
|
215
216
|
}
|
|
@@ -304,18 +305,3 @@ export class UnixTerminal extends Terminal {
|
|
|
304
305
|
delete env['LINES'];
|
|
305
306
|
}
|
|
306
307
|
}
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* Wraps net.Socket to force the handle type "PIPE" by temporarily overwriting
|
|
310
|
-
* tty_wrap.guessHandleType.
|
|
311
|
-
* See: https://github.com/chjj/pty.js/issues/103
|
|
312
|
-
*/
|
|
313
|
-
class PipeSocket extends net.Socket {
|
|
314
|
-
constructor(fd: number) {
|
|
315
|
-
const pipeWrap = (<any>process).binding('pipe_wrap'); // tslint:disable-line
|
|
316
|
-
// @types/node has fd as string? https://github.com/DefinitelyTyped/DefinitelyTyped/pull/18275
|
|
317
|
-
const handle = new pipeWrap.Pipe(pipeWrap.constants.SOCKET);
|
|
318
|
-
handle.open(fd);
|
|
319
|
-
super(<any>{ handle });
|
|
320
|
-
}
|
|
321
|
-
}
|