Open duongtungls opened 6 years ago
I use example code on Electron main thread but get back error Uncaught Exception: TypeError: Sudoer is not a constructor
const {Sudoer} = require('electron-sudo') let options = {name: 'electron sudo application'}, sudoer = new Sudoer(options); /* Spawn subprocess behavior */ let cp = await sudoer.spawn( 'echo', ['$PARAM'], {env: {PARAM: 'VALUE'}} ); cp.on('close', () => { /* cp.output.stdout (Buffer) cp.output.stderr (Buffer) */ });
Please help figure out where is problem. thanks
require('electron-sudo').default
I had to use
const Sudoer = require("electron-sudo").default
There was nothing to unpack when using const { Sudoer } = ...
const { Sudoer } = ...
I use example code on Electron main thread but get back error Uncaught Exception: TypeError: Sudoer is not a constructor
Please help figure out where is problem. thanks