sudo-prompt
sudo-prompt copied to clipboard
Fix "Unable to find pkexec or kdesudo" error on NixOS
Fixes #77
I reused the commit 0e933b7 that fallbacks to which if it cannot find kdesudo or pkexec in the hardcoded paths.
Fixed "Error: User did not grant permission" (from https://github.com/jorangreef/sudo-prompt/issues/77#issuecomment-445900662) by replacing /bin/bash with /usr/bin/env bash.
Additional context
The above error ("Error: User did not grant permission") is very misleading because the underlying issue is that /bin/bash could not be found (the file does not exist on NixOS).
In the future, it would be nice to refactor the error handling in https://github.com/jorangreef/sudo-prompt/blob/master/index.js#L188 so that the error message would be more descriptive.
Hi, what is the status of this PR? We have a same issue maybe this PR solve it.
This looks like a good fix for the issue I ran into (pkexec is not in /usr/bin/pkexec, but is available in PATH). :+1: @jorangreef could you have a look?
I'd like this to be merged as well, although by the time it is I may have worked around this issue.
Pretty please?..
Looks like this was fixed downstream in https://github.com/NixOS/nixpkgs/pull/137912
Yes, it was me who applied that workaround and it's still a workaround.