mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
added ability convert charset from win to unicode on win32
This commit is contained in:
parent
a8181ff813
commit
e7fbb827a5
1 changed files with 15 additions and 4 deletions
|
|
@ -1,8 +1,13 @@
|
|||
/* module make possible connectoin thrue socket.io on a server */
|
||||
|
||||
var io = require('socket.io'),
|
||||
exec = require('child_process').exec,
|
||||
Socket = {};
|
||||
var io = require('socket.io'),
|
||||
exec = require('child_process').exec,
|
||||
Socket = {},
|
||||
charset = require('lib/charset'),
|
||||
Win32_b = false;
|
||||
|
||||
if(process.platform === 'win32')
|
||||
Win32_b = true;
|
||||
|
||||
/**
|
||||
* Function listen on servers port
|
||||
|
|
@ -34,11 +39,17 @@ exports.listen = function(pServer){
|
|||
* @param stderr
|
||||
*/
|
||||
function getExec(error, stdout, stderr) {
|
||||
if(stdout){
|
||||
if(stdout){
|
||||
if(Win32_b)
|
||||
stdout = charset.win2unicode(stdout);
|
||||
|
||||
console.log(stdout);
|
||||
Socket.send(stdout);
|
||||
}
|
||||
if(stderr){
|
||||
if(Win32_b)
|
||||
stderr = charset.win2unicode(stderr);
|
||||
|
||||
console.log('stderr: ' + stderr);
|
||||
Socket.send(stderr);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue