add lisp packages
This commit is contained in:
20
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/conpty_console_list_agent.js
generated
vendored
Normal file
20
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/conpty_console_list_agent.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright (c) 2019, Microsoft Corporation (MIT License).
|
||||
*
|
||||
* This module fetches the console process list for a particular PID. It must be
|
||||
* called from a different process (child_process.fork) as there can only be a
|
||||
* single console attached to a process.
|
||||
*/
|
||||
var getConsoleProcessList;
|
||||
try {
|
||||
getConsoleProcessList = require('../build/Release/conpty_console_list.node').getConsoleProcessList;
|
||||
}
|
||||
catch (err) {
|
||||
getConsoleProcessList = require('../build/Debug/conpty_console_list.node').getConsoleProcessList;
|
||||
}
|
||||
var shellPid = parseInt(process.argv[2], 10);
|
||||
var consoleProcessList = getConsoleProcessList(shellPid);
|
||||
process.send({ consoleProcessList: consoleProcessList });
|
||||
process.exit(0);
|
||||
//# sourceMappingURL=conpty_console_list_agent.js.map
|
||||
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/conpty_console_list_agent.js.map
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/conpty_console_list_agent.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"conpty_console_list_agent.js","sourceRoot":"","sources":["../src/conpty_console_list_agent.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;AAEH,IAAI,qBAA0B,CAAC;AAC/B,IAAI;IACF,qBAAqB,GAAG,OAAO,CAAC,2CAA2C,CAAC,CAAC,qBAAqB,CAAC;CACpG;AAAC,OAAO,GAAG,EAAE;IACZ,qBAAqB,GAAG,OAAO,CAAC,yCAAyC,CAAC,CAAC,qBAAqB,CAAC;CAClG;AAED,IAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC/C,IAAM,kBAAkB,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;AAC3D,OAAO,CAAC,IAAI,CAAC,EAAE,kBAAkB,oBAAA,EAAE,CAAC,CAAC;AACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC"}
|
||||
46
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/eventEmitter2.js
generated
vendored
Normal file
46
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/eventEmitter2.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright (c) 2019, Microsoft Corporation (MIT License).
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var EventEmitter2 = /** @class */ (function () {
|
||||
function EventEmitter2() {
|
||||
this._listeners = [];
|
||||
}
|
||||
Object.defineProperty(EventEmitter2.prototype, "event", {
|
||||
get: function () {
|
||||
var _this = this;
|
||||
if (!this._event) {
|
||||
this._event = function (listener) {
|
||||
_this._listeners.push(listener);
|
||||
var disposable = {
|
||||
dispose: function () {
|
||||
for (var i = 0; i < _this._listeners.length; i++) {
|
||||
if (_this._listeners[i] === listener) {
|
||||
_this._listeners.splice(i, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
return disposable;
|
||||
};
|
||||
}
|
||||
return this._event;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
EventEmitter2.prototype.fire = function (data) {
|
||||
var queue = [];
|
||||
for (var i = 0; i < this._listeners.length; i++) {
|
||||
queue.push(this._listeners[i]);
|
||||
}
|
||||
for (var i = 0; i < queue.length; i++) {
|
||||
queue[i].call(undefined, data);
|
||||
}
|
||||
};
|
||||
return EventEmitter2;
|
||||
}());
|
||||
exports.EventEmitter2 = EventEmitter2;
|
||||
//# sourceMappingURL=eventEmitter2.js.map
|
||||
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/eventEmitter2.js.map
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/eventEmitter2.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"eventEmitter2.js","sourceRoot":"","sources":["../src/eventEmitter2.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAYH;IAAA;QACU,eAAU,GAAmB,EAAE,CAAC;IAgC1C,CAAC;IA7BC,sBAAW,gCAAK;aAAhB;YAAA,iBAkBC;YAjBC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;gBAChB,IAAI,CAAC,MAAM,GAAG,UAAC,QAAuB;oBACpC,KAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;oBAC/B,IAAM,UAAU,GAAG;wBACjB,OAAO,EAAE;4BACP,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gCAC/C,IAAI,KAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;oCACnC,KAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;oCAC7B,OAAO;iCACR;6BACF;wBACH,CAAC;qBACF,CAAC;oBACF,OAAO,UAAU,CAAC;gBACpB,CAAC,CAAC;aACH;YACD,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;;;OAAA;IAEM,4BAAI,GAAX,UAAY,IAAO;QACjB,IAAM,KAAK,GAAmB,EAAE,CAAC;QACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC/C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;SAChC;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACrC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;SAChC;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AAjCD,IAiCC;AAjCY,sCAAa"}
|
||||
30
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/eventEmitter2.test.js
generated
vendored
Normal file
30
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/eventEmitter2.test.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright (c) 2019, Microsoft Corporation (MIT License).
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var assert = require("assert");
|
||||
var eventEmitter2_1 = require("./eventEmitter2");
|
||||
describe('EventEmitter2', function () {
|
||||
it('should fire listeners multiple times', function () {
|
||||
var order = [];
|
||||
var emitter = new eventEmitter2_1.EventEmitter2();
|
||||
emitter.event(function (data) { return order.push(data + 'a'); });
|
||||
emitter.event(function (data) { return order.push(data + 'b'); });
|
||||
emitter.fire(1);
|
||||
emitter.fire(2);
|
||||
assert.deepEqual(order, ['1a', '1b', '2a', '2b']);
|
||||
});
|
||||
it('should not fire listeners once disposed', function () {
|
||||
var order = [];
|
||||
var emitter = new eventEmitter2_1.EventEmitter2();
|
||||
emitter.event(function (data) { return order.push(data + 'a'); });
|
||||
var disposeB = emitter.event(function (data) { return order.push(data + 'b'); });
|
||||
emitter.event(function (data) { return order.push(data + 'c'); });
|
||||
emitter.fire(1);
|
||||
disposeB.dispose();
|
||||
emitter.fire(2);
|
||||
assert.deepEqual(order, ['1a', '1b', '1c', '2a', '2c']);
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=eventEmitter2.test.js.map
|
||||
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/eventEmitter2.test.js.map
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/e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KAAK,CAAC,UAAA,IAAI,IAAI,OAAA,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,EAAtB,CAAsB,CAAC,CAAC;QAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,QAAQ,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,CAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAE,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
||||
50
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/index.js
generated
vendored
Normal file
50
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright (c) 2012-2015, Christopher Jeffrey, Peter Sunde (MIT License)
|
||||
* Copyright (c) 2016, Daniel Imms (MIT License).
|
||||
* Copyright (c) 2018, Microsoft Corporation (MIT License).
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var terminalCtor;
|
||||
if (process.platform === 'win32') {
|
||||
terminalCtor = require('./windowsTerminal').WindowsTerminal;
|
||||
}
|
||||
else {
|
||||
terminalCtor = require('./unixTerminal').UnixTerminal;
|
||||
}
|
||||
/**
|
||||
* Forks a process as a pseudoterminal.
|
||||
* @param file The file to launch.
|
||||
* @param args The file's arguments as argv (string[]) or in a pre-escaped
|
||||
* CommandLine format (string). Note that the CommandLine option is only
|
||||
* available on Windows and is expected to be escaped properly.
|
||||
* @param options The options of the terminal.
|
||||
* @throws When the file passed to spawn with does not exists.
|
||||
* @see CommandLineToArgvW https://msdn.microsoft.com/en-us/library/windows/desktop/bb776391(v=vs.85).aspx
|
||||
* @see Parsing C++ Comamnd-Line Arguments https://msdn.microsoft.com/en-us/library/17w5ykft.aspx
|
||||
* @see GetCommandLine https://msdn.microsoft.com/en-us/library/windows/desktop/ms683156.aspx
|
||||
*/
|
||||
function spawn(file, args, opt) {
|
||||
return new terminalCtor(file, args, opt);
|
||||
}
|
||||
exports.spawn = spawn;
|
||||
/** @deprecated */
|
||||
function fork(file, args, opt) {
|
||||
return new terminalCtor(file, args, opt);
|
||||
}
|
||||
exports.fork = fork;
|
||||
/** @deprecated */
|
||||
function createTerminal(file, args, opt) {
|
||||
return new terminalCtor(file, args, opt);
|
||||
}
|
||||
exports.createTerminal = createTerminal;
|
||||
function open(options) {
|
||||
return terminalCtor.open(options);
|
||||
}
|
||||
exports.open = open;
|
||||
/**
|
||||
* Expose the native API when not Windows, note that this is not public API and
|
||||
* could be removed at any time.
|
||||
*/
|
||||
exports.native = (process.platform !== 'win32' ? require('../build/Release/pty.node') : null);
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/index.js.map
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAKH,IAAI,YAAiB,CAAC;AACtB,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;IAChC,YAAY,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,eAAe,CAAC;CAC7D;KAAM;IACL,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,YAAY,CAAC;CACvD;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,KAAK,CAAC,IAAa,EAAE,IAAwB,EAAE,GAA8C;IAC3G,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;AAC3C,CAAC;AAFD,sBAEC;AAED,kBAAkB;AAClB,SAAgB,IAAI,CAAC,IAAa,EAAE,IAAwB,EAAE,GAA8C;IAC1G,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;AAC3C,CAAC;AAFD,oBAEC;AAED,kBAAkB;AAClB,SAAgB,cAAc,CAAC,IAAa,EAAE,IAAwB,EAAE,GAA8C;IACpH,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;AAC3C,CAAC;AAFD,wCAEC;AAED,SAAgB,IAAI,CAAC,OAAwB;IAC3C,OAAO,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC;AAFD,oBAEC;AAED;;;GAGG;AACU,QAAA,MAAM,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC"}
|
||||
7
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/interfaces.js
generated
vendored
Normal file
7
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/interfaces.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright (c) 2016, Daniel Imms (MIT License).
|
||||
* Copyright (c) 2018, Microsoft Corporation (MIT License).
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=interfaces.js.map
|
||||
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/interfaces.js.map
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/interfaces.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
||||
167
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/terminal.js
generated
vendored
Normal file
167
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/terminal.js
generated
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright (c) 2012-2015, Christopher Jeffrey (MIT License)
|
||||
* Copyright (c) 2016, Daniel Imms (MIT License).
|
||||
* Copyright (c) 2018, Microsoft Corporation (MIT License).
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var events_1 = require("events");
|
||||
var eventEmitter2_1 = require("./eventEmitter2");
|
||||
exports.DEFAULT_COLS = 80;
|
||||
exports.DEFAULT_ROWS = 24;
|
||||
/**
|
||||
* Default messages to indicate PAUSE/RESUME for automatic flow control.
|
||||
* To avoid conflicts with rebound XON/XOFF control codes (such as on-my-zsh),
|
||||
* the sequences can be customized in `IPtyForkOptions`.
|
||||
*/
|
||||
var FLOW_CONTROL_PAUSE = '\x13'; // defaults to XOFF
|
||||
var FLOW_CONTROL_RESUME = '\x11'; // defaults to XON
|
||||
var Terminal = /** @class */ (function () {
|
||||
function Terminal(opt) {
|
||||
this._onData = new eventEmitter2_1.EventEmitter2();
|
||||
this._onExit = new eventEmitter2_1.EventEmitter2();
|
||||
// for 'close'
|
||||
this._internalee = new events_1.EventEmitter();
|
||||
if (!opt) {
|
||||
return;
|
||||
}
|
||||
// Do basic type checks here in case node-pty is being used within JavaScript. If the wrong
|
||||
// types go through to the C++ side it can lead to hard to diagnose exceptions.
|
||||
this._checkType('name', opt.name ? opt.name : null, 'string');
|
||||
this._checkType('cols', opt.cols ? opt.cols : null, 'number');
|
||||
this._checkType('rows', opt.rows ? opt.rows : null, 'number');
|
||||
this._checkType('cwd', opt.cwd ? opt.cwd : null, 'string');
|
||||
this._checkType('env', opt.env ? opt.env : null, 'object');
|
||||
this._checkType('uid', opt.uid ? opt.uid : null, 'number');
|
||||
this._checkType('gid', opt.gid ? opt.gid : null, 'number');
|
||||
this._checkType('encoding', opt.encoding ? opt.encoding : null, 'string');
|
||||
// setup flow control handling
|
||||
this.handleFlowControl = !!(opt.handleFlowControl);
|
||||
this._flowControlPause = opt.flowControlPause || FLOW_CONTROL_PAUSE;
|
||||
this._flowControlResume = opt.flowControlResume || FLOW_CONTROL_RESUME;
|
||||
}
|
||||
Object.defineProperty(Terminal.prototype, "onData", {
|
||||
get: function () { return this._onData.event; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Terminal.prototype, "onExit", {
|
||||
get: function () { return this._onExit.event; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Terminal.prototype, "pid", {
|
||||
get: function () { return this._pid; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Terminal.prototype, "cols", {
|
||||
get: function () { return this._cols; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Terminal.prototype, "rows", {
|
||||
get: function () { return this._rows; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Terminal.prototype.write = function (data) {
|
||||
if (this.handleFlowControl) {
|
||||
// PAUSE/RESUME messages are not forwarded to the pty
|
||||
if (data === this._flowControlPause) {
|
||||
this.pause();
|
||||
return;
|
||||
}
|
||||
if (data === this._flowControlResume) {
|
||||
this.resume();
|
||||
return;
|
||||
}
|
||||
}
|
||||
// everything else goes to the real pty
|
||||
this._write(data);
|
||||
};
|
||||
Terminal.prototype._forwardEvents = function () {
|
||||
var _this = this;
|
||||
this.on('data', function (e) { return _this._onData.fire(e); });
|
||||
this.on('exit', function (exitCode, signal) { return _this._onExit.fire({ exitCode: exitCode, signal: signal }); });
|
||||
};
|
||||
Terminal.prototype._checkType = function (name, value, type) {
|
||||
if (value && typeof value !== type) {
|
||||
throw new Error(name + " must be a " + type + " (not a " + typeof value + ")");
|
||||
}
|
||||
};
|
||||
/** See net.Socket.end */
|
||||
Terminal.prototype.end = function (data) {
|
||||
this._socket.end(data);
|
||||
};
|
||||
/** See stream.Readable.pipe */
|
||||
Terminal.prototype.pipe = function (dest, options) {
|
||||
return this._socket.pipe(dest, options);
|
||||
};
|
||||
/** See net.Socket.pause */
|
||||
Terminal.prototype.pause = function () {
|
||||
return this._socket.pause();
|
||||
};
|
||||
/** See net.Socket.resume */
|
||||
Terminal.prototype.resume = function () {
|
||||
return this._socket.resume();
|
||||
};
|
||||
/** See net.Socket.setEncoding */
|
||||
Terminal.prototype.setEncoding = function (encoding) {
|
||||
if (this._socket._decoder) {
|
||||
delete this._socket._decoder;
|
||||
}
|
||||
if (encoding) {
|
||||
this._socket.setEncoding(encoding);
|
||||
}
|
||||
};
|
||||
Terminal.prototype.addListener = function (eventName, listener) { this.on(eventName, listener); };
|
||||
Terminal.prototype.on = function (eventName, listener) {
|
||||
if (eventName === 'close') {
|
||||
this._internalee.on('close', listener);
|
||||
return;
|
||||
}
|
||||
this._socket.on(eventName, listener);
|
||||
};
|
||||
Terminal.prototype.emit = function (eventName) {
|
||||
var args = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
args[_i - 1] = arguments[_i];
|
||||
}
|
||||
if (eventName === 'close') {
|
||||
return this._internalee.emit.apply(this._internalee, arguments);
|
||||
}
|
||||
return this._socket.emit.apply(this._socket, arguments);
|
||||
};
|
||||
Terminal.prototype.listeners = function (eventName) {
|
||||
return this._socket.listeners(eventName);
|
||||
};
|
||||
Terminal.prototype.removeListener = function (eventName, listener) {
|
||||
this._socket.removeListener(eventName, listener);
|
||||
};
|
||||
Terminal.prototype.removeAllListeners = function (eventName) {
|
||||
this._socket.removeAllListeners(eventName);
|
||||
};
|
||||
Terminal.prototype.once = function (eventName, listener) {
|
||||
this._socket.once(eventName, listener);
|
||||
};
|
||||
Terminal.prototype._close = function () {
|
||||
this._socket.writable = false;
|
||||
this._socket.readable = false;
|
||||
this.write = function () { };
|
||||
this.end = function () { };
|
||||
this._writable = false;
|
||||
this._readable = false;
|
||||
};
|
||||
Terminal.prototype._parseEnv = function (env) {
|
||||
var keys = Object.keys(env || {});
|
||||
var pairs = [];
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
pairs.push(keys[i] + '=' + env[keys[i]]);
|
||||
}
|
||||
return pairs;
|
||||
};
|
||||
return Terminal;
|
||||
}());
|
||||
exports.Terminal = Terminal;
|
||||
//# sourceMappingURL=terminal.js.map
|
||||
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/terminal.js.map
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/terminal.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
58
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/terminal.test.js
generated
vendored
Normal file
58
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/terminal.test.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright (c) 2017, Daniel Imms (MIT License).
|
||||
* Copyright (c) 2018, Microsoft Corporation (MIT License).
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var assert = require("assert");
|
||||
var windowsTerminal_1 = require("./windowsTerminal");
|
||||
var unixTerminal_1 = require("./unixTerminal");
|
||||
var terminalConstructor = (process.platform === 'win32') ? windowsTerminal_1.WindowsTerminal : unixTerminal_1.UnixTerminal;
|
||||
var SHELL = (process.platform === 'win32') ? 'cmd.exe' : '/bin/bash';
|
||||
var terminalCtor;
|
||||
if (process.platform === 'win32') {
|
||||
terminalCtor = require('./windowsTerminal');
|
||||
}
|
||||
else {
|
||||
terminalCtor = require('./unixTerminal');
|
||||
}
|
||||
describe('Terminal', function () {
|
||||
describe('constructor', function () {
|
||||
it('should do basic type checks', function () {
|
||||
assert.throws(function () { return new terminalCtor('a', 'b', { 'name': {} }); }, 'name must be a string (not a object)');
|
||||
});
|
||||
});
|
||||
describe('automatic flow control', function () {
|
||||
it('should respect ctor flow control options', function () {
|
||||
var pty = new terminalConstructor(SHELL, [], { handleFlowControl: true, flowControlPause: 'abc', flowControlResume: '123' });
|
||||
assert.equal(pty.handleFlowControl, true);
|
||||
assert.equal(pty._flowControlPause, 'abc');
|
||||
assert.equal(pty._flowControlResume, '123');
|
||||
});
|
||||
// TODO: I don't think this test ever worked due to pollUntil being used incorrectly
|
||||
// it('should do flow control automatically', async function(): Promise<void> {
|
||||
// // Flow control doesn't work on Windows
|
||||
// if (process.platform === 'win32') {
|
||||
// return;
|
||||
// }
|
||||
// this.timeout(10000);
|
||||
// const pty = new terminalConstructor(SHELL, [], {handleFlowControl: true, flowControlPause: 'PAUSE', flowControlResume: 'RESUME'});
|
||||
// let read: string = '';
|
||||
// pty.on('data', data => read += data);
|
||||
// pty.on('pause', () => read += 'paused');
|
||||
// pty.on('resume', () => read += 'resumed');
|
||||
// pty.write('1');
|
||||
// pty.write('PAUSE');
|
||||
// pty.write('2');
|
||||
// pty.write('RESUME');
|
||||
// pty.write('3');
|
||||
// await pollUntil(() => {
|
||||
// return stripEscapeSequences(read).endsWith('1pausedresumed23');
|
||||
// }, 100, 10);
|
||||
// });
|
||||
});
|
||||
});
|
||||
function stripEscapeSequences(data) {
|
||||
return data.replace(/\u001b\[0K/, '');
|
||||
}
|
||||
//# sourceMappingURL=terminal.test.js.map
|
||||
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/terminal.test.js.map
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/terminal.test.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"terminal.test.js","sourceRoot":"","sources":["../src/terminal.test.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,+BAAiC;AACjC,qDAAoD;AACpD,+CAA8C;AAG9C,IAAM,mBAAmB,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,iCAAe,CAAC,CAAC,CAAC,2BAAY,CAAC;AAC5F,IAAM,KAAK,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,C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ACxB,oBAAoB;QACpB,yBAAyB;QACzB,oBAAoB;QACpB,4BAA4B;QAC5B,sEAAsE;QACtE,iBAAiB;QACjB,MAAM;IACR,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,SAAS,oBAAoB,CAAC,IAAY;IACxC,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AACxC,CAAC"}
|
||||
27
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/testUtils.test.js
generated
vendored
Normal file
27
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/testUtils.test.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright (c) 2019, Microsoft Corporation (MIT License).
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function pollUntil(cb, timeout, interval) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var intervalId = setInterval(function () {
|
||||
if (cb()) {
|
||||
clearInterval(intervalId);
|
||||
clearTimeout(timeoutId);
|
||||
resolve();
|
||||
}
|
||||
}, interval);
|
||||
var timeoutId = setTimeout(function () {
|
||||
clearInterval(intervalId);
|
||||
if (cb()) {
|
||||
resolve();
|
||||
}
|
||||
else {
|
||||
reject();
|
||||
}
|
||||
}, timeout);
|
||||
});
|
||||
}
|
||||
exports.pollUntil = pollUntil;
|
||||
//# sourceMappingURL=testUtils.test.js.map
|
||||
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/testUtils.test.js.map
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/testUtils.test.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"testUtils.test.js","sourceRoot":"","sources":["../src/testUtils.test.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,SAAgB,SAAS,CAAC,EAAiB,EAAE,OAAe,EAAE,QAAgB;IAC5E,OAAO,IAAI,OAAO,CAAO,UAAC,OAAO,EAAE,MAAM;QACvC,IAAM,UAAU,GAAG,WAAW,CAAC;YAC7B,IAAI,EAAE,EAAE,EAAE;gBACR,aAAa,CAAC,UAAU,CAAC,CAAC;gBAC1B,YAAY,CAAC,SAAS,CAAC,CAAC;gBACxB,OAAO,EAAE,CAAC;aACX;QACH,CAAC,EAAE,QAAQ,CAAC,CAAC;QACb,IAAM,SAAS,GAAG,UAAU,CAAC;YAC3B,aAAa,CAAC,UAAU,CAAC,CAAC;YAC1B,IAAI,EAAE,EAAE,EAAE;gBACR,OAAO,EAAE,CAAC;aACX;iBAAM;gBACL,MAAM,EAAE,CAAC;aACV;QACH,CAAC,EAAE,OAAO,CAAC,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAlBD,8BAkBC"}
|
||||
7
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/types.js
generated
vendored
Normal file
7
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/types.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright (c) 2017, Daniel Imms (MIT License).
|
||||
* Copyright (c) 2018, Microsoft Corporation (MIT License).
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/types.js.map
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/types.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
||||
276
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/unixTerminal.js
generated
vendored
Normal file
276
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/unixTerminal.js
generated
vendored
Normal file
@@ -0,0 +1,276 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/**
|
||||
* Copyright (c) 2012-2015, Christopher Jeffrey (MIT License)
|
||||
* Copyright (c) 2016, Daniel Imms (MIT License).
|
||||
* Copyright (c) 2018, Microsoft Corporation (MIT License).
|
||||
*/
|
||||
var net = require("net");
|
||||
var terminal_1 = require("./terminal");
|
||||
var utils_1 = require("./utils");
|
||||
var pty;
|
||||
try {
|
||||
pty = require('../build/Release/pty.node');
|
||||
}
|
||||
catch (outerError) {
|
||||
try {
|
||||
pty = require('../build/Debug/pty.node');
|
||||
}
|
||||
catch (innerError) {
|
||||
console.error('innerError', innerError);
|
||||
// Re-throw the exception from the Release require if the Debug require fails as well
|
||||
throw outerError;
|
||||
}
|
||||
}
|
||||
var DEFAULT_FILE = 'sh';
|
||||
var DEFAULT_NAME = 'xterm';
|
||||
var DESTROY_SOCKET_TIMEOUT_MS = 200;
|
||||
var UnixTerminal = /** @class */ (function (_super) {
|
||||
__extends(UnixTerminal, _super);
|
||||
function UnixTerminal(file, args, opt) {
|
||||
var _this = _super.call(this, opt) || this;
|
||||
if (typeof args === 'string') {
|
||||
throw new Error('args as a string is not supported on unix.');
|
||||
}
|
||||
// Initialize arguments
|
||||
args = args || [];
|
||||
file = file || DEFAULT_FILE;
|
||||
opt = opt || {};
|
||||
opt.env = opt.env || process.env;
|
||||
_this._cols = opt.cols || terminal_1.DEFAULT_COLS;
|
||||
_this._rows = opt.rows || terminal_1.DEFAULT_ROWS;
|
||||
var uid = opt.uid || -1;
|
||||
var gid = opt.gid || -1;
|
||||
var env = utils_1.assign({}, opt.env);
|
||||
if (opt.env === process.env) {
|
||||
_this._sanitizeEnv(env);
|
||||
}
|
||||
var cwd = opt.cwd || process.cwd();
|
||||
var name = opt.name || env.TERM || DEFAULT_NAME;
|
||||
env.TERM = name;
|
||||
var parsedEnv = _this._parseEnv(env);
|
||||
var encoding = (opt.encoding === undefined ? 'utf8' : opt.encoding);
|
||||
var onexit = function (code, signal) {
|
||||
// XXX Sometimes a data event is emitted after exit. Wait til socket is
|
||||
// destroyed.
|
||||
if (!_this._emittedClose) {
|
||||
if (_this._boundClose) {
|
||||
return;
|
||||
}
|
||||
_this._boundClose = true;
|
||||
// From macOS High Sierra 10.13.2 sometimes the socket never gets
|
||||
// closed. A timeout is applied here to avoid the terminal never being
|
||||
// destroyed when this occurs.
|
||||
var timeout_1 = setTimeout(function () {
|
||||
timeout_1 = null;
|
||||
// Destroying the socket now will cause the close event to fire
|
||||
_this._socket.destroy();
|
||||
}, DESTROY_SOCKET_TIMEOUT_MS);
|
||||
_this.once('close', function () {
|
||||
if (timeout_1 !== null) {
|
||||
clearTimeout(timeout_1);
|
||||
}
|
||||
_this.emit('exit', code, signal);
|
||||
});
|
||||
return;
|
||||
}
|
||||
_this.emit('exit', code, signal);
|
||||
};
|
||||
// fork
|
||||
var term = pty.fork(file, args, parsedEnv, cwd, _this._cols, _this._rows, uid, gid, (encoding === 'utf8'), onexit);
|
||||
_this._socket = new PipeSocket(term.fd);
|
||||
if (encoding !== null) {
|
||||
_this._socket.setEncoding(encoding);
|
||||
}
|
||||
// setup
|
||||
_this._socket.on('error', function (err) {
|
||||
// NOTE: fs.ReadStream gets EAGAIN twice at first:
|
||||
if (err.code) {
|
||||
if (~err.code.indexOf('EAGAIN')) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// close
|
||||
_this._close();
|
||||
// EIO on exit from fs.ReadStream:
|
||||
if (!_this._emittedClose) {
|
||||
_this._emittedClose = true;
|
||||
_this.emit('close');
|
||||
}
|
||||
// EIO, happens when someone closes our child process: the only process in
|
||||
// the terminal.
|
||||
// node < 0.6.14: errno 5
|
||||
// node >= 0.6.14: read EIO
|
||||
if (err.code) {
|
||||
if (~err.code.indexOf('errno 5') || ~err.code.indexOf('EIO')) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// throw anything else
|
||||
if (_this.listeners('error').length < 2) {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
_this._pid = term.pid;
|
||||
_this._fd = term.fd;
|
||||
_this._pty = term.pty;
|
||||
_this._file = file;
|
||||
_this._name = name;
|
||||
_this._readable = true;
|
||||
_this._writable = true;
|
||||
_this._socket.on('close', function () {
|
||||
if (_this._emittedClose) {
|
||||
return;
|
||||
}
|
||||
_this._emittedClose = true;
|
||||
_this._close();
|
||||
_this.emit('close');
|
||||
});
|
||||
_this._forwardEvents();
|
||||
return _this;
|
||||
}
|
||||
Object.defineProperty(UnixTerminal.prototype, "master", {
|
||||
get: function () { return this._master; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(UnixTerminal.prototype, "slave", {
|
||||
get: function () { return this._slave; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
UnixTerminal.prototype._write = function (data) {
|
||||
this._socket.write(data);
|
||||
};
|
||||
/**
|
||||
* openpty
|
||||
*/
|
||||
UnixTerminal.open = function (opt) {
|
||||
var self = Object.create(UnixTerminal.prototype);
|
||||
opt = opt || {};
|
||||
if (arguments.length > 1) {
|
||||
opt = {
|
||||
cols: arguments[1],
|
||||
rows: arguments[2]
|
||||
};
|
||||
}
|
||||
var cols = opt.cols || terminal_1.DEFAULT_COLS;
|
||||
var rows = opt.rows || terminal_1.DEFAULT_ROWS;
|
||||
var encoding = (opt.encoding === undefined ? 'utf8' : opt.encoding);
|
||||
// open
|
||||
var term = pty.open(cols, rows);
|
||||
self._master = new PipeSocket(term.master);
|
||||
if (encoding !== null) {
|
||||
self._master.setEncoding(encoding);
|
||||
}
|
||||
self._master.resume();
|
||||
self._slave = new PipeSocket(term.slave);
|
||||
if (encoding !== null) {
|
||||
self._slave.setEncoding(encoding);
|
||||
}
|
||||
self._slave.resume();
|
||||
self._socket = self._master;
|
||||
self._pid = null;
|
||||
self._fd = term.master;
|
||||
self._pty = term.pty;
|
||||
self._file = process.argv[0] || 'node';
|
||||
self._name = process.env.TERM || '';
|
||||
self._readable = true;
|
||||
self._writable = true;
|
||||
self._socket.on('error', function (err) {
|
||||
self._close();
|
||||
if (self.listeners('error').length < 2) {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
self._socket.on('close', function () {
|
||||
self._close();
|
||||
});
|
||||
return self;
|
||||
};
|
||||
UnixTerminal.prototype.destroy = function () {
|
||||
var _this = this;
|
||||
this._close();
|
||||
// Need to close the read stream so node stops reading a dead file
|
||||
// descriptor. Then we can safely SIGHUP the shell.
|
||||
this._socket.once('close', function () {
|
||||
_this.kill('SIGHUP');
|
||||
});
|
||||
this._socket.destroy();
|
||||
};
|
||||
UnixTerminal.prototype.kill = function (signal) {
|
||||
try {
|
||||
process.kill(this.pid, signal || 'SIGHUP');
|
||||
}
|
||||
catch (e) { /* swallow */ }
|
||||
};
|
||||
Object.defineProperty(UnixTerminal.prototype, "process", {
|
||||
/**
|
||||
* Gets the name of the process.
|
||||
*/
|
||||
get: function () {
|
||||
return pty.process(this._fd, this._pty) || this._file;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
/**
|
||||
* TTY
|
||||
*/
|
||||
UnixTerminal.prototype.resize = function (cols, rows) {
|
||||
if (cols <= 0 || rows <= 0 || isNaN(cols) || isNaN(rows) || cols === Infinity || rows === Infinity) {
|
||||
throw new Error('resizing must be done using positive cols and rows');
|
||||
}
|
||||
pty.resize(this._fd, cols, rows);
|
||||
this._cols = cols;
|
||||
this._rows = rows;
|
||||
};
|
||||
UnixTerminal.prototype._sanitizeEnv = function (env) {
|
||||
// Make sure we didn't start our server from inside tmux.
|
||||
delete env['TMUX'];
|
||||
delete env['TMUX_PANE'];
|
||||
// Make sure we didn't start our server from inside screen.
|
||||
// http://web.mit.edu/gnu/doc/html/screen_20.html
|
||||
delete env['STY'];
|
||||
delete env['WINDOW'];
|
||||
// Delete some variables that might confuse our terminal.
|
||||
delete env['WINDOWID'];
|
||||
delete env['TERMCAP'];
|
||||
delete env['COLUMNS'];
|
||||
delete env['LINES'];
|
||||
};
|
||||
return UnixTerminal;
|
||||
}(terminal_1.Terminal));
|
||||
exports.UnixTerminal = UnixTerminal;
|
||||
/**
|
||||
* Wraps net.Socket to force the handle type "PIPE" by temporarily overwriting
|
||||
* tty_wrap.guessHandleType.
|
||||
* See: https://github.com/chjj/pty.js/issues/103
|
||||
*/
|
||||
var PipeSocket = /** @class */ (function (_super) {
|
||||
__extends(PipeSocket, _super);
|
||||
function PipeSocket(fd) {
|
||||
var _this = this;
|
||||
var _a = process.binding('pipe_wrap'), Pipe = _a.Pipe, constants = _a.constants; // tslint:disable-line
|
||||
// @types/node has fd as string? https://github.com/DefinitelyTyped/DefinitelyTyped/pull/18275
|
||||
var handle = new Pipe(constants.SOCKET);
|
||||
handle.open(fd);
|
||||
_this = _super.call(this, { handle: handle }) || this;
|
||||
return _this;
|
||||
}
|
||||
return PipeSocket;
|
||||
}(net.Socket));
|
||||
//# sourceMappingURL=unixTerminal.js.map
|
||||
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/unixTerminal.js.map
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/unixTerminal.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
100
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/unixTerminal.test.js
generated
vendored
Normal file
100
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/unixTerminal.test.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright (c) 2017, Daniel Imms (MIT License).
|
||||
* Copyright (c) 2018, Microsoft Corporation (MIT License).
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var unixTerminal_1 = require("./unixTerminal");
|
||||
var assert = require("assert");
|
||||
var path = require("path");
|
||||
var testUtils_test_1 = require("./testUtils.test");
|
||||
var FIXTURES_PATH = path.normalize(path.join(__dirname, '..', 'fixtures', 'utf8-character.txt'));
|
||||
if (process.platform !== 'win32') {
|
||||
describe('UnixTerminal', function () {
|
||||
describe('Constructor', function () {
|
||||
it('should set a valid pts name', function () {
|
||||
var term = new unixTerminal_1.UnixTerminal('/bin/bash', [], {});
|
||||
var regExp;
|
||||
if (process.platform === 'linux') {
|
||||
// https://linux.die.net/man/4/pts
|
||||
regExp = /^\/dev\/pts\/\d+$/;
|
||||
}
|
||||
if (process.platform === 'darwin') {
|
||||
// https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man4/pty.4.html
|
||||
regExp = /^\/dev\/tty[p-sP-S][a-z0-9]+$/;
|
||||
}
|
||||
if (regExp) {
|
||||
assert.ok(regExp.test(term._pty), '"' + term._pty + '" should match ' + regExp.toString());
|
||||
}
|
||||
});
|
||||
});
|
||||
describe('PtyForkEncodingOption', function () {
|
||||
it('should default to utf8', function (done) {
|
||||
var term = new unixTerminal_1.UnixTerminal('/bin/bash', ['-c', "cat \"" + FIXTURES_PATH + "\""]);
|
||||
term.on('data', function (data) {
|
||||
assert.equal(typeof data, 'string');
|
||||
assert.equal(data, '\u00E6');
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should return a Buffer when encoding is null', function (done) {
|
||||
var term = new unixTerminal_1.UnixTerminal('/bin/bash', ['-c', "cat \"" + FIXTURES_PATH + "\""], {
|
||||
encoding: null
|
||||
});
|
||||
term.on('data', function (data) {
|
||||
assert.equal(typeof data, 'object');
|
||||
assert.ok(data instanceof Buffer);
|
||||
assert.equal(0xC3, data[0]);
|
||||
assert.equal(0xA6, data[1]);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should support other encodings', function (done) {
|
||||
var text = 'test æ!';
|
||||
var term = new unixTerminal_1.UnixTerminal(null, ['-c', 'echo "' + text + '"'], {
|
||||
encoding: 'base64'
|
||||
});
|
||||
var buffer = '';
|
||||
term.on('data', function (data) {
|
||||
assert.equal(typeof data, 'string');
|
||||
buffer += data;
|
||||
});
|
||||
term.on('exit', function () {
|
||||
assert.equal(Buffer.alloc(8, buffer, 'base64').toString().replace('\r', '').replace('\n', ''), text);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('open', function () {
|
||||
var term;
|
||||
afterEach(function () {
|
||||
if (term) {
|
||||
term.slave.destroy();
|
||||
term.master.destroy();
|
||||
}
|
||||
});
|
||||
it('should open a pty with access to a master and slave socket', function (done) {
|
||||
var doneCalled = false;
|
||||
term = unixTerminal_1.UnixTerminal.open({});
|
||||
var slavebuf = '';
|
||||
term.slave.on('data', function (data) {
|
||||
slavebuf += data;
|
||||
});
|
||||
var masterbuf = '';
|
||||
term.master.on('data', function (data) {
|
||||
masterbuf += data;
|
||||
});
|
||||
testUtils_test_1.pollUntil(function () {
|
||||
if (masterbuf === 'slave\r\nmaster\r\n' && slavebuf === 'master\n') {
|
||||
done();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}, 200, 10);
|
||||
term.slave.write('slave\n');
|
||||
term.master.write('master\n');
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=unixTerminal.test.js.map
|
||||
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/unixTerminal.test.js.map
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/unixTerminal.test.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"unixTerminal.test.js","sourceRoot":"","sources":["../src/unixTerminal.test.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,+CAA8C;AAC9C,+BAAiC;AACjC,2BAA6B;AA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KAAK,CAAC,SAAS,CAAC,CAAC;gBAC5B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;CACJ"}
|
||||
16
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/utils.js
generated
vendored
Normal file
16
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/utils.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright (c) 2017, Daniel Imms (MIT License).
|
||||
* Copyright (c) 2018, Microsoft Corporation (MIT License).
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function assign(target) {
|
||||
var sources = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
sources[_i - 1] = arguments[_i];
|
||||
}
|
||||
sources.forEach(function (source) { return Object.keys(source).forEach(function (key) { return target[key] = source[key]; }); });
|
||||
return target;
|
||||
}
|
||||
exports.assign = assign;
|
||||
//# sourceMappingURL=utils.js.map
|
||||
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/utils.js.map
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,SAAgB,MAAM,CAAC,MAAW;IAAE,iBAAiB;SAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;QAAjB,gCAAiB;;IACnD,OAAO,CAAC,OAAO,CAAC,UAAA,MAAM,IAAI,OAAA,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG,IAAI,OAAA,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,EAAzB,CAAyB,CAAC,EAA7D,CAA6D,CAAC,CAAC;IACzF,OAAO,MAAM,CAAC;AAChB,CAAC;AAHD,wBAGC"}
|
||||
310
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/windowsPtyAgent.js
generated
vendored
Normal file
310
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/windowsPtyAgent.js
generated
vendored
Normal file
@@ -0,0 +1,310 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright (c) 2012-2015, Christopher Jeffrey, Peter Sunde (MIT License)
|
||||
* Copyright (c) 2016, Daniel Imms (MIT License).
|
||||
* Copyright (c) 2018, Microsoft Corporation (MIT License).
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var os = require("os");
|
||||
var path = require("path");
|
||||
var net_1 = require("net");
|
||||
var child_process_1 = require("child_process");
|
||||
var conptyNative;
|
||||
var winptyNative;
|
||||
/**
|
||||
* The amount of time to wait for additional data after the conpty shell process has exited before
|
||||
* shutting down the socket. The timer will be reset if a new data event comes in after the timer
|
||||
* has started.
|
||||
*/
|
||||
var FLUSH_DATA_INTERVAL = 20;
|
||||
/**
|
||||
* This agent sits between the WindowsTerminal class and provides a common interface for both conpty
|
||||
* and winpty.
|
||||
*/
|
||||
var WindowsPtyAgent = /** @class */ (function () {
|
||||
function WindowsPtyAgent(file, args, env, cwd, cols, rows, debug, _useConpty, conptyInheritCursor) {
|
||||
var _this = this;
|
||||
if (conptyInheritCursor === void 0) { conptyInheritCursor = false; }
|
||||
this._useConpty = _useConpty;
|
||||
if (this._useConpty === undefined || this._useConpty === true) {
|
||||
this._useConpty = this._getWindowsBuildNumber() >= 18309;
|
||||
}
|
||||
if (this._useConpty) {
|
||||
if (!conptyNative) {
|
||||
try {
|
||||
conptyNative = require('../build/Release/conpty.node');
|
||||
}
|
||||
catch (outerError) {
|
||||
try {
|
||||
conptyNative = require('../build/Debug/conpty.node');
|
||||
}
|
||||
catch (innerError) {
|
||||
console.error('innerError', innerError);
|
||||
// Re-throw the exception from the Release require if the Debug require fails as well
|
||||
throw outerError;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!winptyNative) {
|
||||
try {
|
||||
winptyNative = require('../build/Release/pty.node');
|
||||
}
|
||||
catch (outerError) {
|
||||
try {
|
||||
winptyNative = require('../build/Debug/pty.node');
|
||||
}
|
||||
catch (innerError) {
|
||||
console.error('innerError', innerError);
|
||||
// Re-throw the exception from the Release require if the Debug require fails as well
|
||||
throw outerError;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this._ptyNative = this._useConpty ? conptyNative : winptyNative;
|
||||
// Sanitize input variable.
|
||||
cwd = path.resolve(cwd);
|
||||
// Compose command line
|
||||
var commandLine = argsToCommandLine(file, args);
|
||||
// Open pty session.
|
||||
var term;
|
||||
if (this._useConpty) {
|
||||
term = this._ptyNative.startProcess(file, cols, rows, debug, this._generatePipeName(), conptyInheritCursor);
|
||||
}
|
||||
else {
|
||||
term = this._ptyNative.startProcess(file, commandLine, env, cwd, cols, rows, debug);
|
||||
this._pid = term.pid;
|
||||
this._innerPid = term.innerPid;
|
||||
this._innerPidHandle = term.innerPidHandle;
|
||||
}
|
||||
// Not available on windows.
|
||||
this._fd = term.fd;
|
||||
// Generated incremental number that has no real purpose besides using it
|
||||
// as a terminal id.
|
||||
this._pty = term.pty;
|
||||
// Create terminal pipe IPC channel and forward to a local unix socket.
|
||||
this._outSocket = new net_1.Socket();
|
||||
this._outSocket.setEncoding('utf8');
|
||||
this._outSocket.connect(term.conout, function () {
|
||||
// TODO: Emit event on agent instead of socket?
|
||||
// Emit ready event.
|
||||
_this._outSocket.emit('ready_datapipe');
|
||||
});
|
||||
this._inSocket = new net_1.Socket();
|
||||
this._inSocket.setEncoding('utf8');
|
||||
this._inSocket.connect(term.conin);
|
||||
// TODO: Wait for ready event?
|
||||
if (this._useConpty) {
|
||||
var connect = this._ptyNative.connect(this._pty, commandLine, cwd, env, function (c) { return _this._$onProcessExit(c); });
|
||||
this._innerPid = connect.pid;
|
||||
}
|
||||
}
|
||||
Object.defineProperty(WindowsPtyAgent.prototype, "inSocket", {
|
||||
get: function () { return this._inSocket; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(WindowsPtyAgent.prototype, "outSocket", {
|
||||
get: function () { return this._outSocket; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(WindowsPtyAgent.prototype, "fd", {
|
||||
get: function () { return this._fd; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(WindowsPtyAgent.prototype, "innerPid", {
|
||||
get: function () { return this._innerPid; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(WindowsPtyAgent.prototype, "pty", {
|
||||
get: function () { return this._pty; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
WindowsPtyAgent.prototype.resize = function (cols, rows) {
|
||||
if (this._useConpty) {
|
||||
if (this._exitCode !== undefined) {
|
||||
throw new Error('Cannot resize a pty that has already exited');
|
||||
}
|
||||
this._ptyNative.resize(this._pty, cols, rows);
|
||||
return;
|
||||
}
|
||||
this._ptyNative.resize(this._pid, cols, rows);
|
||||
};
|
||||
WindowsPtyAgent.prototype.kill = function () {
|
||||
var _this = this;
|
||||
this._inSocket.readable = false;
|
||||
this._inSocket.writable = false;
|
||||
this._outSocket.readable = false;
|
||||
this._outSocket.writable = false;
|
||||
// Tell the agent to kill the pty, this releases handles to the process
|
||||
if (this._useConpty) {
|
||||
this._getConsoleProcessList().then(function (consoleProcessList) {
|
||||
consoleProcessList.forEach(function (pid) {
|
||||
try {
|
||||
process.kill(pid);
|
||||
}
|
||||
catch (e) {
|
||||
// Ignore if process cannot be found (kill ESRCH error)
|
||||
}
|
||||
});
|
||||
_this._ptyNative.kill(_this._pty);
|
||||
});
|
||||
}
|
||||
else {
|
||||
this._ptyNative.kill(this._pid, this._innerPidHandle);
|
||||
// Since pty.kill closes the handle it will kill most processes by itself
|
||||
// and process IDs can be reused as soon as all handles to them are
|
||||
// dropped, we want to immediately kill the entire console process list.
|
||||
// If we do not force kill all processes here, node servers in particular
|
||||
// seem to become detached and remain running (see
|
||||
// Microsoft/vscode#26807).
|
||||
var processList = this._ptyNative.getProcessList(this._pid);
|
||||
processList.forEach(function (pid) {
|
||||
try {
|
||||
process.kill(pid);
|
||||
}
|
||||
catch (e) {
|
||||
// Ignore if process cannot be found (kill ESRCH error)
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
WindowsPtyAgent.prototype._getConsoleProcessList = function () {
|
||||
var _this = this;
|
||||
return new Promise(function (resolve) {
|
||||
var agent = child_process_1.fork(path.join(__dirname, 'conpty_console_list_agent'), [_this._innerPid.toString()]);
|
||||
agent.on('message', function (message) {
|
||||
clearTimeout(timeout);
|
||||
resolve(message.consoleProcessList);
|
||||
});
|
||||
var timeout = setTimeout(function () {
|
||||
// Something went wrong, just send back the shell PID
|
||||
agent.kill();
|
||||
resolve([_this._innerPid]);
|
||||
}, 5000);
|
||||
});
|
||||
};
|
||||
Object.defineProperty(WindowsPtyAgent.prototype, "exitCode", {
|
||||
get: function () {
|
||||
if (this._useConpty) {
|
||||
return this._exitCode;
|
||||
}
|
||||
return this._ptyNative.getExitCode(this._innerPidHandle);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
WindowsPtyAgent.prototype._getWindowsBuildNumber = function () {
|
||||
var osVersion = (/(\d+)\.(\d+)\.(\d+)/g).exec(os.release());
|
||||
var buildNumber = 0;
|
||||
if (osVersion && osVersion.length === 4) {
|
||||
buildNumber = parseInt(osVersion[3]);
|
||||
}
|
||||
return buildNumber;
|
||||
};
|
||||
WindowsPtyAgent.prototype._generatePipeName = function () {
|
||||
return "conpty-" + Math.random() * 10000000;
|
||||
};
|
||||
/**
|
||||
* Triggered from the native side when a contpy process exits.
|
||||
*/
|
||||
WindowsPtyAgent.prototype._$onProcessExit = function (exitCode) {
|
||||
var _this = this;
|
||||
this._exitCode = exitCode;
|
||||
this._flushDataAndCleanUp();
|
||||
this._outSocket.on('data', function () { return _this._flushDataAndCleanUp(); });
|
||||
};
|
||||
WindowsPtyAgent.prototype._flushDataAndCleanUp = function () {
|
||||
var _this = this;
|
||||
if (this._closeTimeout) {
|
||||
clearTimeout(this._closeTimeout);
|
||||
}
|
||||
this._closeTimeout = setTimeout(function () { return _this._cleanUpProcess(); }, FLUSH_DATA_INTERVAL);
|
||||
};
|
||||
WindowsPtyAgent.prototype._cleanUpProcess = function () {
|
||||
this._inSocket.readable = false;
|
||||
this._inSocket.writable = false;
|
||||
this._outSocket.readable = false;
|
||||
this._outSocket.writable = false;
|
||||
this._outSocket.destroy();
|
||||
};
|
||||
return WindowsPtyAgent;
|
||||
}());
|
||||
exports.WindowsPtyAgent = WindowsPtyAgent;
|
||||
// Convert argc/argv into a Win32 command-line following the escaping convention
|
||||
// documented on MSDN (e.g. see CommandLineToArgvW documentation). Copied from
|
||||
// winpty project.
|
||||
function argsToCommandLine(file, args) {
|
||||
if (isCommandLine(args)) {
|
||||
if (args.length === 0) {
|
||||
return file;
|
||||
}
|
||||
return argsToCommandLine(file, []) + " " + args;
|
||||
}
|
||||
var argv = [file];
|
||||
Array.prototype.push.apply(argv, args);
|
||||
var result = '';
|
||||
for (var argIndex = 0; argIndex < argv.length; argIndex++) {
|
||||
if (argIndex > 0) {
|
||||
result += ' ';
|
||||
}
|
||||
var arg = argv[argIndex];
|
||||
// if it is empty or it contains whitespace and is not already quoted
|
||||
var hasLopsidedEnclosingQuote = xOr((arg[0] !== '"'), (arg[arg.length - 1] !== '"'));
|
||||
var hasNoEnclosingQuotes = ((arg[0] !== '"') && (arg[arg.length - 1] !== '"'));
|
||||
var quote = arg === '' ||
|
||||
(arg.indexOf(' ') !== -1 ||
|
||||
arg.indexOf('\t') !== -1) &&
|
||||
((arg.length > 1) &&
|
||||
(hasLopsidedEnclosingQuote || hasNoEnclosingQuotes));
|
||||
if (quote) {
|
||||
result += '\"';
|
||||
}
|
||||
var bsCount = 0;
|
||||
for (var i = 0; i < arg.length; i++) {
|
||||
var p = arg[i];
|
||||
if (p === '\\') {
|
||||
bsCount++;
|
||||
}
|
||||
else if (p === '"') {
|
||||
result += repeatText('\\', bsCount * 2 + 1);
|
||||
result += '"';
|
||||
bsCount = 0;
|
||||
}
|
||||
else {
|
||||
result += repeatText('\\', bsCount);
|
||||
bsCount = 0;
|
||||
result += p;
|
||||
}
|
||||
}
|
||||
if (quote) {
|
||||
result += repeatText('\\', bsCount * 2);
|
||||
result += '\"';
|
||||
}
|
||||
else {
|
||||
result += repeatText('\\', bsCount);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
exports.argsToCommandLine = argsToCommandLine;
|
||||
function isCommandLine(args) {
|
||||
return typeof args === 'string';
|
||||
}
|
||||
function repeatText(text, count) {
|
||||
var result = '';
|
||||
for (var i = 0; i < count; i++) {
|
||||
result += text;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function xOr(arg1, arg2) {
|
||||
return ((arg1 && !arg2) || (!arg1 && arg2));
|
||||
}
|
||||
//# sourceMappingURL=windowsPtyAgent.js.map
|
||||
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/windowsPtyAgent.js.map
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/windowsPtyAgent.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
90
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/windowsPtyAgent.test.js
generated
vendored
Normal file
90
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/windowsPtyAgent.test.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright (c) 2017, Daniel Imms (MIT License).
|
||||
* Copyright (c) 2018, Microsoft Corporation (MIT License).
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var assert = require("assert");
|
||||
var windowsPtyAgent_1 = require("./windowsPtyAgent");
|
||||
function check(file, args, expected) {
|
||||
assert.equal(windowsPtyAgent_1.argsToCommandLine(file, args), expected);
|
||||
}
|
||||
if (process.platform === 'win32') {
|
||||
describe('argsToCommandLine', function () {
|
||||
describe('Plain strings', function () {
|
||||
it('doesn\'t quote plain string', function () {
|
||||
check('asdf', [], 'asdf');
|
||||
});
|
||||
it('doesn\'t escape backslashes', function () {
|
||||
check('\\asdf\\qwer\\', [], '\\asdf\\qwer\\');
|
||||
});
|
||||
it('doesn\'t escape multiple backslashes', function () {
|
||||
check('asdf\\\\qwer', [], 'asdf\\\\qwer');
|
||||
});
|
||||
it('adds backslashes before quotes', function () {
|
||||
check('"asdf"qwer"', [], '\\"asdf\\"qwer\\"');
|
||||
});
|
||||
it('escapes backslashes before quotes', function () {
|
||||
check('asdf\\"qwer', [], 'asdf\\\\\\"qwer');
|
||||
});
|
||||
});
|
||||
describe('Quoted strings', function () {
|
||||
it('quotes string with spaces', function () {
|
||||
check('asdf qwer', [], '"asdf qwer"');
|
||||
});
|
||||
it('quotes empty string', function () {
|
||||
check('', [], '""');
|
||||
});
|
||||
it('quotes string with tabs', function () {
|
||||
check('asdf\tqwer', [], '"asdf\tqwer"');
|
||||
});
|
||||
it('escapes only the last backslash', function () {
|
||||
check('\\asdf \\qwer\\', [], '"\\asdf \\qwer\\\\"');
|
||||
});
|
||||
it('doesn\'t escape multiple backslashes', function () {
|
||||
check('asdf \\\\qwer', [], '"asdf \\\\qwer"');
|
||||
});
|
||||
it('escapes backslashes before quotes', function () {
|
||||
check('asdf \\"qwer', [], '"asdf \\\\\\"qwer"');
|
||||
});
|
||||
it('escapes multiple backslashes at the end', function () {
|
||||
check('asdf qwer\\\\', [], '"asdf qwer\\\\\\\\"');
|
||||
});
|
||||
});
|
||||
describe('Multiple arguments', function () {
|
||||
it('joins arguments with spaces', function () {
|
||||
check('asdf', ['qwer zxcv', '', '"'], 'asdf "qwer zxcv" "" \\"');
|
||||
});
|
||||
it('array argument all in quotes', function () {
|
||||
check('asdf', ['"surounded by quotes"'], 'asdf \\"surounded by quotes\\"');
|
||||
});
|
||||
it('array argument quotes in the middle', function () {
|
||||
check('asdf', ['quotes "in the" middle'], 'asdf "quotes \\"in the\\" middle"');
|
||||
});
|
||||
it('array argument quotes near start', function () {
|
||||
check('asdf', ['"quotes" near start'], 'asdf "\\"quotes\\" near start"');
|
||||
});
|
||||
it('array argument quotes near end', function () {
|
||||
check('asdf', ['quotes "near end"'], 'asdf "quotes \\"near end\\""');
|
||||
});
|
||||
});
|
||||
describe('Args as CommandLine', function () {
|
||||
it('should handle empty string', function () {
|
||||
check('file', '', 'file');
|
||||
});
|
||||
it('should not change args', function () {
|
||||
check('file', 'foo bar baz', 'file foo bar baz');
|
||||
check('file', 'foo \\ba"r \baz', 'file foo \\ba"r \baz');
|
||||
});
|
||||
});
|
||||
describe('Real-world cases', function () {
|
||||
it('quotes within quotes', function () {
|
||||
check('cmd.exe', ['/c', 'powershell -noexit -command \'Set-location \"C:\\user\"\''], 'cmd.exe /c "powershell -noexit -command \'Set-location \\\"C:\\user\\"\'"');
|
||||
});
|
||||
it('space within quotes', function () {
|
||||
check('cmd.exe', ['/k', '"C:\\Users\\alros\\Desktop\\test script.bat"'], 'cmd.exe /k \\"C:\\Users\\alros\\Desktop\\test script.bat\\"');
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=windowsPtyAgent.test.js.map
|
||||
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/windowsPtyAgent.test.js.map
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/windowsPtyAgent.test.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"windowsPtyAgent.test.js","sourceRoot":"","sources":["../src/windowsPtyAgent.test.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,+BAAiC;AACjC,qDAAsD;AAEtD,SAAS,KAAK,CA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C,CAAC;YACvE,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,qBAAqB,EAAE;YAC9B,EAAE,CAAC,4BAA4B,EAAE;gBAC/B,KAAK,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,wBAAwB,EAAE;gBAC3B,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,kBAAkB,CAAC,CAAC;gBACjD,KAAK,CAAC,MAAM,EAAE,iBAAiB,EAAE,sBAAsB,CAAC,CAAC;YAC3D,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,kBAAkB,EAAE;YAC3B,EAAE,CAAC,sBAAsB,EAAE;gBACzB,KAAK,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,2DAA2D,CAAC,EAAE,2EAA2E,CAAC,CAAC;YACrK,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,qBAAqB,EAAE;gBACxB,KAAK,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,8CAA8C,CAAC,EAAE,6DAA6D,CAAC,CAAC;YAC1I,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;CACJ"}
|
||||
181
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/windowsTerminal.js
generated
vendored
Normal file
181
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/windowsTerminal.js
generated
vendored
Normal file
@@ -0,0 +1,181 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright (c) 2012-2015, Christopher Jeffrey, Peter Sunde (MIT License)
|
||||
* Copyright (c) 2016, Daniel Imms (MIT License).
|
||||
* Copyright (c) 2018, Microsoft Corporation (MIT License).
|
||||
*/
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var terminal_1 = require("./terminal");
|
||||
var windowsPtyAgent_1 = require("./windowsPtyAgent");
|
||||
var utils_1 = require("./utils");
|
||||
var DEFAULT_FILE = 'cmd.exe';
|
||||
var DEFAULT_NAME = 'Windows Shell';
|
||||
var WindowsTerminal = /** @class */ (function (_super) {
|
||||
__extends(WindowsTerminal, _super);
|
||||
function WindowsTerminal(file, args, opt) {
|
||||
var _this = _super.call(this, opt) || this;
|
||||
// Initialize arguments
|
||||
args = args || [];
|
||||
file = file || DEFAULT_FILE;
|
||||
opt = opt || {};
|
||||
opt.env = opt.env || process.env;
|
||||
if (opt.encoding) {
|
||||
console.warn('Setting encoding on Windows is not supported');
|
||||
}
|
||||
var env = utils_1.assign({}, opt.env);
|
||||
_this._cols = opt.cols || terminal_1.DEFAULT_COLS;
|
||||
_this._rows = opt.rows || terminal_1.DEFAULT_ROWS;
|
||||
var cwd = opt.cwd || process.cwd();
|
||||
var name = opt.name || env.TERM || DEFAULT_NAME;
|
||||
var parsedEnv = _this._parseEnv(env);
|
||||
// If the terminal is ready
|
||||
_this._isReady = false;
|
||||
// Functions that need to run after `ready` event is emitted.
|
||||
_this._deferreds = [];
|
||||
// Create new termal.
|
||||
_this._agent = new windowsPtyAgent_1.WindowsPtyAgent(file, args, parsedEnv, cwd, _this._cols, _this._rows, false, opt.useConpty, opt.conptyInheritCursor);
|
||||
_this._socket = _this._agent.outSocket;
|
||||
// Not available until `ready` event emitted.
|
||||
_this._pid = _this._agent.innerPid;
|
||||
_this._fd = _this._agent.fd;
|
||||
_this._pty = _this._agent.pty;
|
||||
// The forked windows terminal is not available until `ready` event is
|
||||
// emitted.
|
||||
_this._socket.on('ready_datapipe', function () {
|
||||
// These events needs to be forwarded.
|
||||
['connect', 'data', 'end', 'timeout', 'drain'].forEach(function (event) {
|
||||
_this._socket.on(event, function () {
|
||||
// Wait until the first data event is fired then we can run deferreds.
|
||||
if (!_this._isReady && event === 'data') {
|
||||
// Terminal is now ready and we can avoid having to defer method
|
||||
// calls.
|
||||
_this._isReady = true;
|
||||
// Execute all deferred methods
|
||||
_this._deferreds.forEach(function (fn) {
|
||||
// NB! In order to ensure that `this` has all its references
|
||||
// updated any variable that need to be available in `this` before
|
||||
// the deferred is run has to be declared above this forEach
|
||||
// statement.
|
||||
fn.run();
|
||||
});
|
||||
// Reset
|
||||
_this._deferreds = [];
|
||||
}
|
||||
});
|
||||
});
|
||||
// Shutdown if `error` event is emitted.
|
||||
_this._socket.on('error', function (err) {
|
||||
// Close terminal session.
|
||||
_this._close();
|
||||
// EIO, happens when someone closes our child process: the only process
|
||||
// in the terminal.
|
||||
// node < 0.6.14: errno 5
|
||||
// node >= 0.6.14: read EIO
|
||||
if (err.code) {
|
||||
if (~err.code.indexOf('errno 5') || ~err.code.indexOf('EIO'))
|
||||
return;
|
||||
}
|
||||
// Throw anything else.
|
||||
if (_this.listeners('error').length < 2) {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
// Cleanup after the socket is closed.
|
||||
_this._socket.on('close', function () {
|
||||
_this.emit('exit', _this._agent.exitCode);
|
||||
_this._close();
|
||||
});
|
||||
});
|
||||
_this._file = file;
|
||||
_this._name = name;
|
||||
_this._readable = true;
|
||||
_this._writable = true;
|
||||
_this._forwardEvents();
|
||||
return _this;
|
||||
}
|
||||
WindowsTerminal.prototype._write = function (data) {
|
||||
this._defer(this._doWrite, data);
|
||||
};
|
||||
WindowsTerminal.prototype._doWrite = function (data) {
|
||||
this._agent.inSocket.write(data);
|
||||
};
|
||||
/**
|
||||
* openpty
|
||||
*/
|
||||
WindowsTerminal.open = function (options) {
|
||||
throw new Error('open() not supported on windows, use Fork() instead.');
|
||||
};
|
||||
/**
|
||||
* TTY
|
||||
*/
|
||||
WindowsTerminal.prototype.resize = function (cols, rows) {
|
||||
var _this = this;
|
||||
if (cols <= 0 || rows <= 0 || isNaN(cols) || isNaN(rows) || cols === Infinity || rows === Infinity) {
|
||||
throw new Error('resizing must be done using positive cols and rows');
|
||||
}
|
||||
this._defer(function () {
|
||||
_this._agent.resize(cols, rows);
|
||||
_this._cols = cols;
|
||||
_this._rows = rows;
|
||||
});
|
||||
};
|
||||
WindowsTerminal.prototype.destroy = function () {
|
||||
var _this = this;
|
||||
this._defer(function () {
|
||||
_this.kill();
|
||||
});
|
||||
};
|
||||
WindowsTerminal.prototype.kill = function (signal) {
|
||||
var _this = this;
|
||||
this._defer(function () {
|
||||
if (signal) {
|
||||
throw new Error('Signals not supported on windows.');
|
||||
}
|
||||
_this._close();
|
||||
_this._agent.kill();
|
||||
});
|
||||
};
|
||||
WindowsTerminal.prototype._defer = function (deferredFn, arg) {
|
||||
var _this = this;
|
||||
// If the terminal is ready, execute.
|
||||
if (this._isReady) {
|
||||
deferredFn.call(this, arg);
|
||||
return;
|
||||
}
|
||||
// Queue until terminal is ready.
|
||||
this._deferreds.push({
|
||||
run: function () { return deferredFn.call(_this, arg); }
|
||||
});
|
||||
};
|
||||
Object.defineProperty(WindowsTerminal.prototype, "process", {
|
||||
get: function () { return this._name; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(WindowsTerminal.prototype, "master", {
|
||||
get: function () { throw new Error('master is not supported on Windows'); },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(WindowsTerminal.prototype, "slave", {
|
||||
get: function () { throw new Error('slave is not supported on Windows'); },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return WindowsTerminal;
|
||||
}(terminal_1.Terminal));
|
||||
exports.WindowsTerminal = WindowsTerminal;
|
||||
//# sourceMappingURL=windowsTerminal.js.map
|
||||
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/windowsTerminal.js.map
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/windowsTerminal.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"windowsTerminal.js","sourceRoot":"","sources":["../src/windowsTerminal.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;AAGH,uCAAkE;AAClE,qDAAoD;AAGpD,iCAAiC;AAEjC,IAAM,YAAY,GAAG,SAAS,CAAC;AAC/B,IAAM,YAAY,GAAG,eAAe,CAAC;AAErC;IAAqC,mCAAQ;IAK3C,yBAAY,IAAa,EAAE,IAAwB,EAAE,GAA4B;QAAjF,YACE,kBAAM,GAAG,CAAC,SAmGX;QAjGC,uBAAuB;QACvB,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAClB,IAAI,GAAG,IAAI,IAAI,YAAY,CAAC;QAC5B,GAAG,GAAG,GAAG,IAAI,EAAE,CAAC;QAChB,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;QAEjC,IAAI,GAAG,CAAC,QAAQ,EAAE;YAChB,OAAO,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;SAC9D;QAED,IAAM,GAAG,GAAG,cAAM,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;QAChC,KAAI,CAAC,KAAK,GAAG,GAAG,CAAC,IAAI,IAAI,uBAAY,CAAC;QACtC,KAAI,CAAC,KAAK,GAAG,GAAG,CAAC,IAAI,IAAI,uBAAY,CAAC;QACtC,IAAM,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QACrC,IAAM,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,YAAY,CAAC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GAAd,UAA8B,UAA6B,EAAE,GAAO;QAApE,iBAWC;QAVC,qCAAqC;QACrC,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAC3B,OAAO;SACR;QAED,iCAAiC;QACjC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YACnB,GAAG,EAAE,cAAM,OAAA,UAAU,CAAC,IAAI,CAAC,KAAI,EAAE,GAAG,CAAC,EAA1B,CAA0B;SACtC,CAAC,CAAC;IACL,CAAC;IAED,sBAAW,oCAAO;aAAlB,cAA+B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;;;OAAA;IACnD,sBAAW,mCAAM;aAAjB,cAA8B,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC,CAAC,CAAC;;;OAAA;IACtF,sBAAW,kCAAK;aAAhB,cAA6B,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC,CAAC,CAAC;;;OAAA;IACtF,sBAAC;AAAD,CAAC,AA1KD,CAAqC,mBAAQ,GA0K5C;AA1KY,0CAAe"}
|
||||
195
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/windowsTerminal.test.js
generated
vendored
Normal file
195
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/windowsTerminal.test.js
generated
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright (c) 2017, Daniel Imms (MIT License).
|
||||
* Copyright (c) 2018, Microsoft Corporation (MIT License).
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var fs = require("fs");
|
||||
var assert = require("assert");
|
||||
var windowsTerminal_1 = require("./windowsTerminal");
|
||||
var path = require("path");
|
||||
var psList = require("ps-list");
|
||||
function pollForProcessState(desiredState, intervalMs, timeoutMs) {
|
||||
if (intervalMs === void 0) { intervalMs = 100; }
|
||||
if (timeoutMs === void 0) { timeoutMs = 2000; }
|
||||
return new Promise(function (resolve) {
|
||||
var tries = 0;
|
||||
var interval = setInterval(function () {
|
||||
psList({ all: true }).then(function (ps) {
|
||||
var success = true;
|
||||
var pids = Object.keys(desiredState).map(function (k) { return parseInt(k, 10); });
|
||||
pids.forEach(function (pid) {
|
||||
if (desiredState[pid]) {
|
||||
if (!ps.some(function (p) { return p.pid === pid; })) {
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ps.some(function (p) { return p.pid === pid; })) {
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (success) {
|
||||
clearInterval(interval);
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
tries++;
|
||||
if (tries * intervalMs >= timeoutMs) {
|
||||
clearInterval(interval);
|
||||
var processListing = pids.map(function (k) { return k + ": " + desiredState[k]; }).join('\n');
|
||||
assert.fail("Bad process state, expected:\n" + processListing);
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}, intervalMs);
|
||||
});
|
||||
}
|
||||
function pollForProcessTreeSize(pid, size, intervalMs, timeoutMs) {
|
||||
if (intervalMs === void 0) { intervalMs = 100; }
|
||||
if (timeoutMs === void 0) { timeoutMs = 2000; }
|
||||
return new Promise(function (resolve) {
|
||||
var tries = 0;
|
||||
var interval = setInterval(function () {
|
||||
psList({ all: true }).then(function (ps) {
|
||||
var openList = [];
|
||||
openList.push(ps.filter(function (p) { return p.pid === pid; }).map(function (p) {
|
||||
return { name: p.name, pid: p.pid };
|
||||
})[0]);
|
||||
var list = [];
|
||||
var _loop_1 = function () {
|
||||
var current = openList.shift();
|
||||
ps.filter(function (p) { return p.ppid === current.pid; }).map(function (p) {
|
||||
return { name: p.name, pid: p.pid };
|
||||
}).forEach(function (p) { return openList.push(p); });
|
||||
list.push(current);
|
||||
};
|
||||
while (openList.length) {
|
||||
_loop_1();
|
||||
}
|
||||
var success = list.length === size;
|
||||
if (success) {
|
||||
clearInterval(interval);
|
||||
resolve(list);
|
||||
return;
|
||||
}
|
||||
tries++;
|
||||
if (tries * intervalMs >= timeoutMs) {
|
||||
clearInterval(interval);
|
||||
assert.fail("Bad process state, expected: " + size + ", actual: " + list.length);
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}, intervalMs);
|
||||
});
|
||||
}
|
||||
if (process.platform === 'win32') {
|
||||
describe('WindowsTerminal', function () {
|
||||
describe('kill', function () {
|
||||
it('should not crash parent process', function (done) {
|
||||
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], {});
|
||||
term.kill();
|
||||
// Add done call to deferred function queue to ensure the kill call has completed
|
||||
term._defer(done);
|
||||
});
|
||||
it('should kill the process tree', function (done) {
|
||||
this.timeout(5000);
|
||||
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], {});
|
||||
// Start sub-processes
|
||||
term.write('powershell.exe\r');
|
||||
term.write('notepad.exe\r');
|
||||
term.write('node.exe\r');
|
||||
pollForProcessTreeSize(term.pid, 4, 500, 5000).then(function (list) {
|
||||
assert.equal(list[0].name, 'cmd.exe');
|
||||
assert.equal(list[1].name, 'powershell.exe');
|
||||
assert.equal(list[2].name, 'notepad.exe');
|
||||
assert.equal(list[3].name, 'node.exe');
|
||||
term.kill();
|
||||
var desiredState = {};
|
||||
desiredState[list[0].pid] = false;
|
||||
desiredState[list[1].pid] = false;
|
||||
desiredState[list[2].pid] = true;
|
||||
desiredState[list[3].pid] = false;
|
||||
pollForProcessState(desiredState).then(function () {
|
||||
// Kill notepad before done
|
||||
process.kill(list[2].pid);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('resize', function () {
|
||||
it('should throw a non-native exception when resizing an invalid value', function () {
|
||||
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], {});
|
||||
assert.throws(function () { return term.resize(-1, -1); });
|
||||
assert.throws(function () { return term.resize(0, 0); });
|
||||
assert.doesNotThrow(function () { return term.resize(1, 1); });
|
||||
});
|
||||
it('should throw an non-native exception when resizing a killed terminal', function (done) {
|
||||
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], {});
|
||||
term._defer(function () {
|
||||
term.on('exit', function () {
|
||||
assert.throws(function () { return term.resize(1, 1); });
|
||||
done();
|
||||
});
|
||||
term.destroy();
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('Args as CommandLine', function () {
|
||||
it('should not fail running a file containing a space in the path', function (done) {
|
||||
var spaceFolder = path.resolve(__dirname, '..', 'fixtures', 'space folder');
|
||||
if (!fs.existsSync(spaceFolder)) {
|
||||
fs.mkdirSync(spaceFolder);
|
||||
}
|
||||
var cmdCopiedPath = path.resolve(spaceFolder, 'cmd.exe');
|
||||
var data = fs.readFileSync(process.env.windir + "\\System32\\cmd.exe");
|
||||
fs.writeFileSync(cmdCopiedPath, data);
|
||||
if (!fs.existsSync(cmdCopiedPath)) {
|
||||
// Skip test if git bash isn't installed
|
||||
return;
|
||||
}
|
||||
var term = new windowsTerminal_1.WindowsTerminal(cmdCopiedPath, '/c echo "hello world"', {});
|
||||
var result = '';
|
||||
term.on('data', function (data) {
|
||||
result += data;
|
||||
});
|
||||
term.on('exit', function () {
|
||||
assert.ok(result.indexOf('hello world') >= 1);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('env', function () {
|
||||
it('should set environment variables of the shell', function (done) {
|
||||
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '/C echo %FOO%', { env: { FOO: 'BAR' } });
|
||||
var result = '';
|
||||
term.on('data', function (data) {
|
||||
result += data;
|
||||
});
|
||||
term.on('exit', function () {
|
||||
assert.ok(result.indexOf('BAR') >= 0);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('On close', function () {
|
||||
it('should return process zero exit codes', function (done) {
|
||||
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '/C exit');
|
||||
term.on('exit', function (code) {
|
||||
assert.equal(code, 0);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should return process non-zero exit codes', function (done) {
|
||||
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '/C exit 2');
|
||||
term.on('exit', function (code) {
|
||||
assert.equal(code, 2);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=windowsTerminal.test.js.map
|
||||
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/windowsTerminal.test.js.map
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/terminal/node_modules/node-pty/lib/windowsTerminal.test.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user