powershell: modifications
This commit is contained in:
parent
3650fef0ae
commit
f78f263221
@ -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!
|
||||
|
||||
|
||||
18
lib/util.js
18
lib/util.js
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user