node compatibility fixes

This commit is contained in:
Sebastian Hildebrandt 2025-12-29 00:05:38 +01:00
parent f5e33bc69b
commit 4af416daa9

View File

@ -510,7 +510,7 @@ function powerShell(cmd) {
try {
const osVersion = os.release().split('.').map(Number);
const spanOptions =
osVersion[0] < 0
osVersion[0] < 10
? ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-']
: ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-ExecutionPolicy', 'Unrestricted', '-Command', cmd];
const child = spawn(_powerShell, spanOptions, {
@ -543,7 +543,7 @@ function powerShell(cmd) {
child.kill();
resolve(result);
});
if (osVersion[0] < 0) {
if (osVersion[0] < 10) {
try {
child.stdin.write(_psToUTF8 + cmd + os.EOL);
child.stdin.write('exit' + os.EOL);