added ability convert charset from win to unicode on win32

This commit is contained in:
coderaiser 2012-09-21 06:48:31 -04:00
parent a8181ff813
commit e7fbb827a5

View file

@ -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);
}