systeminformation 6.0.0-beta.23 → 6.0.0-beta.24
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.
- package/dist/common/const.d.ts +2 -0
- package/dist/common/const.js +8 -3
- package/dist/common/exec.d.ts +5 -2
- package/dist/common/exec.js +6 -3
- package/dist/common/windows.js +2 -2
- package/package.json +1 -1
package/dist/common/const.d.ts
CHANGED
|
@@ -9,12 +9,14 @@ export declare const SUNOS: boolean;
|
|
|
9
9
|
export declare const WINDOWS: boolean;
|
|
10
10
|
export declare const ANDROID: boolean;
|
|
11
11
|
export declare const WINDIR: string;
|
|
12
|
+
export declare const WIN_CWD: string | undefined;
|
|
12
13
|
export declare const execOptsWin: {
|
|
13
14
|
windowsHide: boolean;
|
|
14
15
|
maxBuffer: number;
|
|
15
16
|
env: NodeJS.ProcessEnv & {
|
|
16
17
|
LANG: string;
|
|
17
18
|
};
|
|
19
|
+
cwd: string | undefined;
|
|
18
20
|
};
|
|
19
21
|
export declare const execOptsLinux: {
|
|
20
22
|
maxBuffer: number;
|
package/dist/common/const.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VBOXMANAGE = exports.UNKNOWN = exports.MAX_BUFFER_SIZE = exports.execOptsLinux = exports.execOptsWin = exports.WINDIR = exports.ANDROID = exports.WINDOWS = exports.SUNOS = exports.NETBSD = exports.OPENBSD = exports.LINUX = exports.FREEBSD = exports.DARWIN = exports.AIX = exports.PLATFORM = void 0;
|
|
3
|
+
exports.VBOXMANAGE = exports.UNKNOWN = exports.MAX_BUFFER_SIZE = exports.execOptsLinux = exports.execOptsWin = exports.WIN_CWD = exports.WINDIR = exports.ANDROID = exports.WINDOWS = exports.SUNOS = exports.NETBSD = exports.OPENBSD = exports.LINUX = exports.FREEBSD = exports.DARWIN = exports.AIX = exports.PLATFORM = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
4
5
|
exports.PLATFORM = process.platform;
|
|
5
6
|
exports.AIX = exports.PLATFORM === 'aix';
|
|
6
7
|
exports.DARWIN = exports.PLATFORM === 'darwin';
|
|
@@ -12,10 +13,13 @@ exports.SUNOS = exports.PLATFORM === 'sunos';
|
|
|
12
13
|
exports.WINDOWS = exports.PLATFORM === 'win32';
|
|
13
14
|
exports.ANDROID = exports.PLATFORM === 'android';
|
|
14
15
|
exports.WINDIR = process.env.WINDIR || 'C:\\Windows';
|
|
16
|
+
const WIN_SYSDIR = `${exports.WINDIR}\\system32`;
|
|
17
|
+
exports.WIN_CWD = exports.WINDOWS && (0, node_fs_1.existsSync)(WIN_SYSDIR) ? WIN_SYSDIR : undefined;
|
|
15
18
|
exports.execOptsWin = {
|
|
16
19
|
windowsHide: true,
|
|
17
20
|
maxBuffer: 1024 * 102400,
|
|
18
|
-
env: Object.assign({}, process.env, { LANG: 'en_US.UTF-8' })
|
|
21
|
+
env: Object.assign({}, process.env, { LANG: 'en_US.UTF-8' }),
|
|
22
|
+
cwd: exports.WIN_CWD
|
|
19
23
|
};
|
|
20
24
|
exports.execOptsLinux = {
|
|
21
25
|
maxBuffer: 1024 * 102400,
|
|
@@ -23,4 +27,5 @@ exports.execOptsLinux = {
|
|
|
23
27
|
};
|
|
24
28
|
exports.MAX_BUFFER_SIZE = 1024 * 102400;
|
|
25
29
|
exports.UNKNOWN = 'unknown';
|
|
26
|
-
|
|
30
|
+
const VBOX_PATH = (process.env.VBOX_INSTALL_PATH || process.env.VBOX_MSI_INSTALL_PATH || '').replace(/["%!^&|<>`$;\r\n]/g, '');
|
|
31
|
+
exports.VBOXMANAGE = exports.WINDOWS ? (VBOX_PATH ? `"${VBOX_PATH}\\VBoxManage.exe"` : 'VBoxManage.exe') : 'vboxmanage';
|
package/dist/common/exec.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { execFile as execFileFunction, exec as execFunction } from 'node:child_process';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
declare const _exec: typeof execFunction.__promisify__;
|
|
3
|
+
declare const _execFile: typeof execFileFunction.__promisify__;
|
|
4
|
+
export declare const exec: typeof _exec;
|
|
5
|
+
export declare const execFile: typeof _execFile;
|
|
4
6
|
export declare const shareInflight: <T>(key: string, fn: () => Promise<T>) => Promise<T>;
|
|
5
7
|
export declare const execSecure: (cmd: string, args: any, options?: any) => Promise<string>;
|
|
6
8
|
export declare const timeout: (ms: number) => Promise<unknown>;
|
|
@@ -8,3 +10,4 @@ export declare const execSave: (cmd: string, options?: any) => Promise<{
|
|
|
8
10
|
stdout: string;
|
|
9
11
|
stderr: string;
|
|
10
12
|
}>;
|
|
13
|
+
export {};
|
package/dist/common/exec.js
CHANGED
|
@@ -4,8 +4,11 @@ exports.execSave = exports.timeout = exports.execSecure = exports.shareInflight
|
|
|
4
4
|
const node_child_process_1 = require("node:child_process");
|
|
5
5
|
const node_util_1 = require("node:util");
|
|
6
6
|
const const_1 = require("./const");
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const withWinCwd = (options) => (const_1.WIN_CWD && !options?.cwd ? { ...options, cwd: const_1.WIN_CWD } : options);
|
|
8
|
+
const _exec = (0, node_util_1.promisify)(node_child_process_1.exec);
|
|
9
|
+
const _execFile = (0, node_util_1.promisify)(node_child_process_1.execFile);
|
|
10
|
+
exports.exec = ((cmd, options) => _exec(cmd, withWinCwd(options)));
|
|
11
|
+
exports.execFile = ((file, args, options) => _execFile(file, args, withWinCwd(options)));
|
|
9
12
|
const _inflight = new Map();
|
|
10
13
|
const shareInflight = (key, fn) => {
|
|
11
14
|
if (!_inflight.has(key)) {
|
|
@@ -30,7 +33,7 @@ const execSecure = (cmd, args, options) => {
|
|
|
30
33
|
resolve(result);
|
|
31
34
|
};
|
|
32
35
|
try {
|
|
33
|
-
const child = (0, node_child_process_1.spawn)(cmd, args, { stdio: ['pipe', 'pipe', 'ignore'], ...spawnOptions });
|
|
36
|
+
const child = (0, node_child_process_1.spawn)(cmd, args, withWinCwd({ stdio: ['pipe', 'pipe', 'ignore'], ...spawnOptions }));
|
|
34
37
|
if (child?.pid) {
|
|
35
38
|
if (timeoutMs) {
|
|
36
39
|
timer = setTimeout(() => {
|
package/dist/common/windows.js
CHANGED
|
@@ -5,14 +5,13 @@ const node_child_process_1 = require("node:child_process");
|
|
|
5
5
|
const exec_1 = require("./exec");
|
|
6
6
|
const files_1 = require("../common/files");
|
|
7
7
|
const const_1 = require("./const");
|
|
8
|
-
const WINDIR = process.env.WINDIR || String.raw `C:\Windows`;
|
|
9
8
|
const JOB_TIMEOUT_MS = 60000;
|
|
10
9
|
let _powerShell = '';
|
|
11
10
|
const pickPowerShellExecutable = async () => {
|
|
12
11
|
if (!const_1.WINDOWS)
|
|
13
12
|
return '';
|
|
14
13
|
if (!_powerShell) {
|
|
15
|
-
const defaultPath = String.raw `${WINDIR}\system32\WindowsPowerShell\v1.0\powershell.exe`;
|
|
14
|
+
const defaultPath = String.raw `${const_1.WINDIR}\system32\WindowsPowerShell\v1.0\powershell.exe`;
|
|
16
15
|
if (await (0, files_1.fileExists)(defaultPath)) {
|
|
17
16
|
_powerShell = defaultPath;
|
|
18
17
|
}
|
|
@@ -65,6 +64,7 @@ class PowerShellWorker {
|
|
|
65
64
|
this.child = (0, node_child_process_1.spawn)(this.exe, args, {
|
|
66
65
|
stdio: 'pipe',
|
|
67
66
|
windowsHide: true,
|
|
67
|
+
cwd: const_1.WIN_CWD,
|
|
68
68
|
env: { ...process.env, ...this.env }
|
|
69
69
|
});
|
|
70
70
|
this.child.stdout.setEncoding('utf8');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.24",
|
|
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)",
|