Win Powershell UTF8 support
This commit is contained in:
parent
41376979e2
commit
b4cd550b16
@ -283,7 +283,7 @@ function users(callback) {
|
||||
}
|
||||
if (_windows) {
|
||||
try {
|
||||
util.execWin('query user', util.execOptsWin, function (error, stdout) {
|
||||
util.powerShell('query user').then(stdout => {
|
||||
if (stdout) {
|
||||
// lines / split
|
||||
let lines = stdout.toString().split('\r\n');
|
||||
|
||||
@ -341,6 +341,7 @@ function getVboxmanage() {
|
||||
function powerShell(cmd) {
|
||||
|
||||
let result = '';
|
||||
const psUTF8 = '$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; ';
|
||||
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
@ -375,7 +376,7 @@ function powerShell(cmd) {
|
||||
resolve(result);
|
||||
});
|
||||
try {
|
||||
child.stdin.write(cmd + os.EOL);
|
||||
child.stdin.write(psUTF8 + cmd + os.EOL);
|
||||
child.stdin.write('exit' + os.EOL);
|
||||
child.stdin.end();
|
||||
} catch (e) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user