-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sudo: a password is required #50
Comments
You're probably on a Mac, and your ticket sounds like its related to this: #39 Basically Mac's
I've instead started to use the workaround with This is what the
If |
Duplicated #39 |
I also would like a fix for this one. Will switch to sudo-prompt until then. |
If you require sudo prompt on mac then this is all you really need: var cp = require('child_process')
var isRoot = (process.getuid && process.getuid() === 0)
if (!isRoot) {
var cmd = `echo hello`
var prompt = `/usr/bin/osascript -e 'do shell script "bash -c \\\"${cmd}\\\"" with administrator privileges'`
cp.exec(prompt)
} |
Running example code doesn't work
index.js
output
Would appreciate it if someone can point me in the right direction.
Thanks!
The text was updated successfully, but these errors were encountered: