-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat: make query_command
shell-agnostic
#19
Conversation
`query_command` is now of type `table` so that `vim.fn.jobstart` does not use `shell`.
query_command
shell-agnosticquery_command
shell-agnostic
lua/auto-dark-mode/init.lua
Outdated
else | ||
return | ||
end | ||
|
||
if vim.fn.has("unix") ~= 0 then | ||
if vim.loop.getuid() == 0 then | ||
query_command = "su - $SUDO_USER -c " .. query_command | ||
query_command = vim.tbl_extend("keep", { "su", "-", "$SUDO_USER", "-c" }, query_command) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure how this command will behave now.
It seems like su
will spawn the default shell indicated in /etc/passwd
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR so far (with my suggestions applied) breaks the plugin on Linux/NixOS for me.
I'll take another look on Linux and macOS tomorrow.
Hey @nekowinston! Does your commit fix the issues with the PR? Feel free to merge this if it works for you or close it otherwise :) |
It doesn't, my commit so far was a simple syntax error fix, the whole PR doesn't work for me in its current state. |
No worries, do as you wish whenever you wish with this one :) |
I have tested this branch on Windows, WSL and Fedora 40 and those work. |
this should help with escalation methods that aren't sudo, we don't have to add support for them right now, but at least alert the user that an error occurred.
Sorry for taking ages to get to this! 😓 As an aside, I've also started to use nushell exclusively on my system, so this PR is much appreciated. |
query_command
shell-agnosticquery_command
shell-agnostic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully tested on:
- Linux/NixOS
- macOS Sequoia
- Windows 10
- WSL
and again, thanks for your contribution 😄
fixes #18
query_command
is now of typetable
so thatvim.fn.jobstart
doesnot use
shell
.Tested on Windows 11 with nushell.
Needs testing in:
The code in
parse_query_response
now needs to handle a table, instead of a string, because thequery_command
cannot use pipes any more, which previously guaranteed that stdout consisted of one line.