Comparing version 1.1.0-beta14 to 1.1.0-beta15
@@ -28,6 +28,8 @@ "use strict"; | ||
var WindowsPtyAgent = /** @class */ (function () { | ||
function WindowsPtyAgent(file, args, env, cwd, cols, rows, debug, _useConpty, conptyInheritCursor) { | ||
function WindowsPtyAgent(file, args, env, cwd, cols, rows, debug, _useConpty, _useConptyDll, conptyInheritCursor) { | ||
var _this = this; | ||
if (_useConptyDll === void 0) { _useConptyDll = false; } | ||
if (conptyInheritCursor === void 0) { conptyInheritCursor = false; } | ||
this._useConpty = _useConpty; | ||
this._useConptyDll = _useConptyDll; | ||
this._pid = 0; | ||
@@ -80,3 +82,3 @@ this._innerPid = 0; | ||
if (this._useConpty) { | ||
term = this._ptyNative.startProcess(file, cols, rows, debug, this._generatePipeName(), conptyInheritCursor); | ||
term = this._ptyNative.startProcess(file, cols, rows, debug, this._generatePipeName(), conptyInheritCursor, this._useConptyDll); | ||
} | ||
@@ -146,3 +148,3 @@ else { | ||
} | ||
this._ptyNative.resize(this._pty, cols, rows); | ||
this._ptyNative.resize(this._pty, cols, rows, this._useConptyDll); | ||
return; | ||
@@ -172,3 +174,3 @@ } | ||
}); | ||
_this._ptyNative.kill(_this._pty); | ||
_this._ptyNative.kill(_this._pty, _this._useConptyDll); | ||
}); | ||
@@ -175,0 +177,0 @@ } |
@@ -51,3 +51,3 @@ "use strict"; | ||
// Create new termal. | ||
_this._agent = new windowsPtyAgent_1.WindowsPtyAgent(file, args, parsedEnv, cwd, _this._cols, _this._rows, false, opt.useConpty, opt.conptyInheritCursor); | ||
_this._agent = new windowsPtyAgent_1.WindowsPtyAgent(file, args, parsedEnv, cwd, _this._cols, _this._rows, false, opt.useConpty, opt.useConptyDll, opt.conptyInheritCursor); | ||
_this._socket = _this._agent.outSocket; | ||
@@ -54,0 +54,0 @@ // Not available until `ready` event emitted. |
@@ -97,3 +97,3 @@ "use strict"; | ||
it('should kill the process tree', function (done) { | ||
this.timeout(5000); | ||
this.timeout(10000); | ||
var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], { useConpty: useConpty }); | ||
@@ -133,3 +133,3 @@ // Start sub-processes | ||
term._defer(function () { | ||
term.on('exit', function () { | ||
term.once('exit', function () { | ||
assert.throws(function () { return term.resize(1, 1); }); | ||
@@ -136,0 +136,0 @@ done(); |
@@ -7,3 +7,3 @@ { | ||
}, | ||
"version": "1.1.0-beta14", | ||
"version": "1.1.0-beta15", | ||
"license": "MIT", | ||
@@ -10,0 +10,0 @@ "main": "./lib/index.js", |
@@ -107,2 +107,3 @@ # node-pty | ||
- [Windows SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk) - only the "Desktop C++ Apps" components are needed to be installed | ||
- Spectre-mitigated libraries - In order to avoid the build error "MSB8040: Spectre-mitigated libraries are required for this project", open the Visual Studio Installer, press the Modify button, navigate to the "Individual components" tab, search "Spectre", and install an option like "MSVC v143 - VS 2022 C++ x64/x86 Spectre-mitigated libs (Latest)" (the exact option to install will depend on your version of Visual Studio as well as your operating system architecture) | ||
@@ -109,0 +110,0 @@ ## Debugging |
@@ -1,6 +0,9 @@ | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
//@ts-check | ||
var RELEASE_DIR = path.join(__dirname, '..', 'build', 'Release'); | ||
var BUILD_FILES = [ | ||
const fs = require('fs'); | ||
const os = require('os'); | ||
const path = require('path'); | ||
const RELEASE_DIR = path.join(__dirname, '../build/Release'); | ||
const BUILD_FILES = [ | ||
path.join(RELEASE_DIR, 'conpty.node'), | ||
@@ -18,10 +21,14 @@ path.join(RELEASE_DIR, 'conpty.pdb'), | ||
]; | ||
const CONPTY_DIR = path.join(__dirname, '../third_party/conpty'); | ||
const CONPTY_SUPPORTED_ARCH = ['x64', 'arm64']; | ||
cleanFolderRecursive = function(folder) { | ||
console.log('\x1b[32m> Cleaning release folder...\x1b[0m'); | ||
function cleanFolderRecursive(folder) { | ||
var files = []; | ||
if( fs.existsSync(folder) ) { | ||
if (fs.existsSync(folder)) { | ||
files = fs.readdirSync(folder); | ||
files.forEach(function(file,index) { | ||
var curPath = path.join(folder, file); | ||
if(fs.lstatSync(curPath).isDirectory()) { // recurse | ||
if (fs.lstatSync(curPath).isDirectory()) { // recurse | ||
cleanFolderRecursive(curPath); | ||
@@ -40,5 +47,27 @@ fs.rmdirSync(curPath); | ||
console.log(e); | ||
//process.exit(1); | ||
} finally { | ||
process.exit(0); | ||
process.exit(1); | ||
} | ||
console.log(`\x1b[32m> Moving conpty.dll...\x1b[0m`); | ||
if (os.platform() !== 'win32') { | ||
console.log(' SKIPPED (not Windows)'); | ||
} else { | ||
const windowsArch = os.arch(); | ||
if (!CONPTY_SUPPORTED_ARCH.includes(windowsArch)) { | ||
console.log(` SKIPPED (unsupported architecture ${windowsArch})`); | ||
} else { | ||
const versionFolder = fs.readdirSync(CONPTY_DIR)[0]; | ||
console.log(` Found version ${versionFolder}`); | ||
const sourceFolder = path.join(CONPTY_DIR, versionFolder, `win10-${windowsArch}`); | ||
const destFolder = path.join(RELEASE_DIR, 'conpty'); | ||
fs.mkdirSync(destFolder, { recursive: true }); | ||
for (const file of ['conpty.dll', 'OpenConsole.exe']) { | ||
const sourceFile = path.join(sourceFolder, file); | ||
const destFile = path.join(destFolder, file); | ||
console.log(` Copying ${sourceFile} -> ${destFile}`); | ||
fs.copyFileSync(sourceFile, destFile); | ||
} | ||
} | ||
} | ||
process.exit(0); |
@@ -122,2 +122,3 @@ /** | ||
useConpty?: boolean; | ||
useConptyDll?: boolean; | ||
conptyInheritCursor?: boolean; | ||
@@ -124,0 +125,0 @@ } |
@@ -6,7 +6,7 @@ /** | ||
interface IConptyNative { | ||
startProcess(file: string, cols: number, rows: number, debug: boolean, pipeName: string, conptyInheritCursor: boolean): IConptyProcess; | ||
startProcess(file: string, cols: number, rows: number, debug: boolean, pipeName: string, conptyInheritCursor: boolean, useConptyDll: boolean): IConptyProcess; | ||
connect(ptyId: number, commandLine: string, cwd: string, env: string[], onExitCallback: (exitCode: number) => void): { pid: number }; | ||
resize(ptyId: number, cols: number, rows: number): void; | ||
resize(ptyId: number, cols: number, rows: number, useConptyDll: boolean): void; | ||
clear(ptyId: number): void; | ||
kill(ptyId: number): void; | ||
kill(ptyId: number, useConptyDll: boolean): void; | ||
} | ||
@@ -13,0 +13,0 @@ |
@@ -57,2 +57,3 @@ /** | ||
private _useConpty: boolean | undefined, | ||
private _useConptyDll: boolean = false, | ||
conptyInheritCursor: boolean = false | ||
@@ -103,3 +104,3 @@ ) { | ||
if (this._useConpty) { | ||
term = (this._ptyNative as IConptyNative).startProcess(file, cols, rows, debug, this._generatePipeName(), conptyInheritCursor); | ||
term = (this._ptyNative as IConptyNative).startProcess(file, cols, rows, debug, this._generatePipeName(), conptyInheritCursor, this._useConptyDll); | ||
} else { | ||
@@ -149,6 +150,6 @@ term = (this._ptyNative as IWinptyNative).startProcess(file, commandLine, env, cwd, cols, rows, debug); | ||
} | ||
this._ptyNative.resize(this._pty, cols, rows); | ||
(this._ptyNative as IConptyNative).resize(this._pty, cols, rows, this._useConptyDll); | ||
return; | ||
} | ||
this._ptyNative.resize(this._pid, cols, rows); | ||
(this._ptyNative as IWinptyNative).resize(this._pid, cols, rows); | ||
} | ||
@@ -175,3 +176,3 @@ | ||
}); | ||
(this._ptyNative as IConptyNative).kill(this._pty); | ||
(this._ptyNative as IConptyNative).kill(this._pty, this._useConptyDll); | ||
}); | ||
@@ -178,0 +179,0 @@ } else { |
@@ -101,3 +101,3 @@ /** | ||
it('should kill the process tree', function (done: Mocha.Done): void { | ||
this.timeout(5000); | ||
this.timeout(10000); | ||
const term = new WindowsTerminal('cmd.exe', [], { useConpty }); | ||
@@ -138,3 +138,3 @@ // Start sub-processes | ||
(<any>term)._defer(() => { | ||
term.on('exit', () => { | ||
term.once('exit', () => { | ||
assert.throws(() => term.resize(1, 1)); | ||
@@ -141,0 +141,0 @@ done(); |
@@ -51,3 +51,3 @@ /** | ||
// Create new termal. | ||
this._agent = new WindowsPtyAgent(file, args, parsedEnv, cwd, this._cols, this._rows, false, opt.useConpty, opt.conptyInheritCursor); | ||
this._agent = new WindowsPtyAgent(file, args, parsedEnv, cwd, this._cols, this._rows, false, opt.useConpty, opt.useConptyDll, opt.conptyInheritCursor); | ||
this._socket = this._agent.outSocket; | ||
@@ -54,0 +54,0 @@ |
@@ -99,2 +99,10 @@ /** | ||
/** | ||
* (EXPERIMENTAL) | ||
* | ||
* Whether to use the conpty.dll shipped with the node-pty package instead of the one built into | ||
* Windows. Defaults to false. | ||
*/ | ||
useConptyDll?: boolean; | ||
/** | ||
* Whether to use PSEUDOCONSOLE_INHERIT_CURSOR in conpty. | ||
@@ -101,0 +109,0 @@ * @see https://docs.microsoft.com/en-us/windows/console/createpseudoconsole |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1156631
252
4527
165