powershell: modifications

This commit is contained in:
Sebastian Hildebrandt 2025-09-16 08:43:42 +02:00
parent 3650fef0ae
commit f78f263221
2 changed files with 10 additions and 10 deletions

View File

@ -31,7 +31,7 @@
## The Systeminformation Project ## The Systeminformation Project
This is amazing. Started as a small project just for myself, it now has > 18,000 This is amazing. Started as a small project just for myself, it now has > 18,000
lines of code, > 700 versions published, up to 9 mio downloads per month, > 380 lines of code, > 700 versions published, up to 9 mio downloads per month, > 400
mio downloads overall. Top 10 NPM ranking for backend packages. Thank you to all mio downloads overall. Top 10 NPM ranking for backend packages. Thank you to all
who contributed to this project! who contributed to this project!

View File

@ -490,7 +490,7 @@ function powerShell(cmd) {
return new Promise((resolve) => { return new Promise((resolve) => {
process.nextTick(() => { process.nextTick(() => {
try { try {
const child = spawn(_powerShell, ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-'], { const child = spawn(_powerShell, ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-ExecutionPolicy', 'Unrestricted', '-Command', cmd], {
stdio: 'pipe', stdio: 'pipe',
windowsHide: true, windowsHide: true,
maxBuffer: 1024 * 20000, maxBuffer: 1024 * 20000,
@ -520,14 +520,14 @@ function powerShell(cmd) {
child.kill(); child.kill();
resolve(result); resolve(result);
}); });
try { // try {
child.stdin.write(_psToUTF8 + cmd + os.EOL); // child.stdin.write(_psToUTF8 + cmd + os.EOL);
child.stdin.write('exit' + os.EOL); // child.stdin.write('exit' + os.EOL);
child.stdin.end(); // child.stdin.end();
} catch (e) { // } catch (e) {
child.kill(); // child.kill();
resolve(result); // resolve(result);
} // }
} else { } else {
resolve(result); resolve(result);
} }