benkuper / Chataigne

Artist-friendly Modular Machine for Art and Technology
https://benjamin.kuperberg.fr/chataigne
GNU General Public License v3.0
1.21k stars 58 forks source link

MacOS Shutdown command : force doesn't work #186

Closed DonGuig closed 1 year ago

DonGuig commented 1 year ago

Is your feature request related to a problem? Please describe. On Mac OS, the "force" option of the shutdown command (OS module) doesn't do anything. By looking at the source code, this "force" option only works on windows.

Describe the solution you'd like On MacOS, applescript seems to be used to trigger shutdown. There is a shell command : "shutdown -h now" that forces shutdown without asking for applications to save their documents. This is the behaviour that I would expect from the "force" option. Thing is, it requires sudo : "sudo shutdown -h now". So it doesn't work as such when using the "Launch Command" command.

Describe alternatives you've considered Is there a way to have Chataigne use the "sudo shutdown -h now" when doing shutdown with force option, without requiring for the user to input its password at the time of exec ?

benkuper commented 1 year ago

Did you try launching chataigne as sudo, and from there launching the command with sudo ?

DonGuig commented 1 year ago

Yes, it works, but it's a bit of a hack, and still requires to input admnistrator password when you launch Chataigne with sudo.

benkuper commented 1 year ago

It would be a concerning security breach if Chataigne could launch sudo commands without being sudo itself. Anybody could do a lot of harm..

DonGuig commented 1 year ago

Good point...