systeminformation 5.25.4 → 5.25.5

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.
Files changed (2) hide show
  1. package/lib/osinfo.js +20 -1
  2. package/package.json +1 -1
package/lib/osinfo.js CHANGED
@@ -1120,7 +1120,26 @@ function shell(callback) {
1120
1120
  return new Promise((resolve) => {
1121
1121
  process.nextTick(() => {
1122
1122
  if (_windows) {
1123
- resolve('cmd');
1123
+ try {
1124
+ const result = 'CMD';
1125
+ util.powerShell(`Get-CimInstance -className win32_process | where-object {$_.ProcessId -eq ${process.ppid} } | select Name`).then(stdout => {
1126
+ let result = 'CMD';
1127
+ if (stdout) {
1128
+ if (stdout.toString().toLowerCase().indexOf('powershell') >= 0) {
1129
+ result = 'PowerShell';
1130
+ }
1131
+ }
1132
+ if (callback) {
1133
+ callback(result);
1134
+ }
1135
+ resolve(result);
1136
+ });
1137
+ } catch {
1138
+ if (callback) {
1139
+ callback(result);
1140
+ }
1141
+ resolve(result);
1142
+ }
1124
1143
  } else {
1125
1144
  let result = '';
1126
1145
  exec('echo $SHELL', function (error, stdout) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.25.4",
3
+ "version": "5.25.5",
4
4
  "description": "Advanced, lightweight system and OS information library",
5
5
  "license": "MIT",
6
6
  "author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",