automation-stack / electron-sudo

Electron subprocesses with administrative privileges, prompting the user with an OS dialog if necessary.
MIT License
382 stars 55 forks source link

about windows usage #56

Closed zyairzy closed 6 years ago

zyairzy commented 6 years ago

I follow the usage (Version 4.0.*) , and I use electron-sudo@4.0.12 , my test.js is below:

var Sudoer = require('electron-sudo').default; let options = {name: 'electron sudo application'}; var sudoer = new Sudoer(options);

sudoer.spawn('cmd.exe', ['echo', 'hello']).then(function (cp) { cp.stdout.on('data', (msg) => { console.log('Looks like we have a message on STDOUT'); console.log(err.toString('utf8')); });

cp.stderr.on('data',(err) => { console.log('Looks like we have a message on STDERR'); console.log(err.toString('utf8')); });

cp.on('close',() => { console.log('Processed Finished!'); }); });

But the result is: err err2

Please help me to point out What's wrong with my usage. Thx

I found some relative issue #47, so closed.