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
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
who contributed to this project!

View File

@ -490,7 +490,7 @@ function powerShell(cmd) {
return new Promise((resolve) => {
process.nextTick(() => {
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',
windowsHide: true,
maxBuffer: 1024 * 20000,
@ -520,14 +520,14 @@ function powerShell(cmd) {
child.kill();
resolve(result);
});
try {
child.stdin.write(_psToUTF8 + cmd + os.EOL);
child.stdin.write('exit' + os.EOL);
child.stdin.end();
} catch (e) {
child.kill();
resolve(result);
}
// try {
// child.stdin.write(_psToUTF8 + cmd + os.EOL);
// child.stdin.write('exit' + os.EOL);
// child.stdin.end();
// } catch (e) {
// child.kill();
// resolve(result);
// }
} else {
resolve(result);
}