automation-stack / electron-sudo

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

Support for sudo with tty-tickets enabled (MacOS Sierra by default) #39

Open automation-stack opened 7 years ago

automation-stack commented 7 years ago

https://derflounder.wordpress.com/2016/09/21/tty_tickets-option-now-on-by-default-for-macos-sierras-sudo-tool/

ZackMattor commented 7 years ago

Hello! Just want to check if this is the issue i'm hitting. I have a simple app just trying to test out electron-sudo. Here is my code and the output. Running on MacOS Sierra.

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

sudoer.spawn('ls', ['/']).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!');
  });
});
$ electron launcher.js
Looks like we have a message on STDERR
sudo: a password is required

Processed Finished!
igor-lemon commented 7 years ago

@automation-stack Hi Aleksandr. Do you have any ideas how to fix that?

automation-stack commented 7 years ago

@igor-lemon yes, it will be fixed soon, sudo will become not required for electron-sudo

igor-lemon commented 7 years ago

Cool. Thank you. I'm looking forward changes. :)

justechn commented 7 years ago

@automation-stack So is this completely broken on MacOS Sierra or can it still be used? Do you have an ETA on the fix?

automation-stack commented 7 years ago

@justechn working hard on this issues, details will follow

treyreynolds commented 7 years ago

Any chance this is fixed? I have been using sudo-prompt but it is actually quite poor in that it doesn't give you access to the underlying child process after it is created.

rameerez commented 7 years ago

Same issue here. macOS Sierra 10.12.5.

DSBalaban commented 7 years ago

Would also love to see this working again. If there's anything we can do to help, let us know! I'd jump in to fix it, but I have little idea where to start.

automation-stack commented 7 years ago

@DSBalaban the idea is to refuse to use sudo in this package, I'm working on this

eriklarko commented 7 years ago

I ran into the same issue and made it work on Sierra at least by using osascript.

The change is hacky but might help someone running into this problem, https://github.com/eriklarko/electron-sudo/commit/f71134f86541b15359f4813715d721818fb2b1f4

robsontenorio commented 7 years ago

@eriklarko i think you should post a PR to @automation-stack :)

imdreamrunner commented 7 years ago

Personally I feel the osascript idea is a bit too hack-ish. Really looking forward to @automation-stack 's fix.

pronebird commented 6 years ago

@imdreamrunner yeah but how's that any different from using sudo and what difference does it make if electron-sudo is broken for over 6 months..

wemteqdev commented 6 years ago

Is electron-sudo still maintaining? any updates for this issue?