Thursday 18 May 2017

Not getting desired output in electron app but getting the same in node CLI using same Nodejs file

I'm trying to display docker container logs in my electron app. I'm using dockerode API.I can't find the command in dockerode so i used node-cmd to execute in CLI and get the output. But it is working only in NodeJs command line but the same in electron comes with extra characters like the image. Any help would be appreciated.

Node js file:

var Docker = require('dockerode')
var docker = new Docker({ host:'127.0.0.1',port:2375});
//festive_jepsen is container name.
//using alert for electron and console for nodejs CLI

var cnt='festive_jepsen';
var cmd=require('node-cmd');
function onl()
{
    cmd.get(
        'docker logs '+cnt,
        function(err, data, stderr){
            alert(data);
            //console.log(data);
        }
    );
}

This is the input i want and it is executing perfectly in nodejs CLI

This is how the output is in Electron app if i use the same code and alert box instead of console.log



via Shakthi Nandana

No comments:

Post a Comment