From 4222bb0294b912fd00c5dce233e0f424cf3eded5 Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Tue, 26 Nov 2019 10:29:57 -0800 Subject: [PATCH] Added Start(), StartPowerShell(), and PowerShellCapable, to match old API --- modules/win-virtual-terminal.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/modules/win-virtual-terminal.js b/modules/win-virtual-terminal.js index c0d8549..add9d04 100644 --- a/modules/win-virtual-terminal.js +++ b/modules/win-virtual-terminal.js @@ -120,6 +120,32 @@ function vt() } throw ('Internal Error'); } + this.PowerShellCapable = function () + { + if (require('os').arch() == 'x64') + { + return (require('fs').existsSync(process.env['windir'] + '\\SysWow64\\WindowsPowerShell\\v1.0\\powershell.exe')); + } + else + { + return (require('fs').existsSync(process.env['windir'] + '\\System32\\WindowsPowerShell\\v1.0\\powershell.exe')); + } + } + this.Start = function Start(CONSOLE_SCREEN_WIDTH, CONSOLE_SCREEN_HEIGHT) + { + return (this.Create(process.env['windir'] + '\\System32\\cmd.exe', CONSOLE_SCREEN_WIDTH, CONSOLE_SCREEN_HEIGHT)); + } + this.StartPowerShell = function StartPowerShell(CONSOLE_SCREEN_WIDTH, CONSOLE_SCREEN_HEIGHT) + { + if (require('os').arch() == 'x64') + { + return (this.Create(process.env['windir'] + '\\SysWow64\\WindowsPowerShell\\v1.0\\powershell.exe', CONSOLE_SCREEN_WIDTH, CONSOLE_SCREEN_HEIGHT)); + } + else + { + return (this.Create(process.env['windir'] + '\\System32\\WindowsPowerShell\\v1.0\\powershell.exe', CONSOLE_SCREEN_WIDTH, CONSOLE_SCREEN_HEIGHT)); + } + } } if (process.platform == 'win32')