shell() added pawershell detection
This commit is contained in:
parent
c7d4751518
commit
f3c402248e
@ -1122,15 +1122,13 @@ function shell(callback) {
|
||||
if (_windows) {
|
||||
try {
|
||||
const result = 'CMD';
|
||||
util.powerShell('$PSVersionTable').then(stdout => {
|
||||
util.powerShell(`Get-CimInstance -className win32_process | where-object {$_.ProcessId -eq ${process.ppid} } | select Name`).then(stdout => {
|
||||
let result = 'CMD';
|
||||
if (stdout) {
|
||||
const lines = stdout.toString().toLowerCase().split('\n').map(line => line.replace(/ +/g, ' ').replace(/ +/g, ':'));
|
||||
const ps = getValue(lines, 'psversion');
|
||||
let result = 'CMD';
|
||||
if (ps) {
|
||||
result = `PowerShell ${ps.split('.')[0] + (ps.split('.')[1] ? '.' + ps.split('.')[1] : '')}`;
|
||||
if (stdout.toString().toLowerCase().indexOf('powershell') >= 0) {
|
||||
result = 'PowerShell';
|
||||
}
|
||||
};
|
||||
}
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user