Fix escaping issue for shell commands#401
Open
arntanguy wants to merge 1 commit into
Open
Conversation
Owner
|
This is a tricky edge case that is not well documented, so apologies for that. As you have discovered, when you pass in a string for the command it is run in the shell, but that still gets escaped. However, what you may not have noticed is that the escaping only happens if you also pass in overseer.nvim/lua/overseer/task.lua Lines 83 to 92 in fae7247 Is it possible for you to pass all of those arguments in with the command string? If so, that should solve your issue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I am using
overseer.nvimin conjunction withcmake-tools.nvim.In
cmake-toolsI defined a task as{ cmake_command = "source /home/ubuntu/setup.sh && cmake", -- I am doing cross compilation and need specific $PATH and such cmake_generate_options = { "-DCMAKE_EXPORT_COMPILE_COMMANDS=1", "-GNinja", " -DCMAKE_C_COMPILER_LAUNCHER=ccache", "-DCMAKE_CXX_COMPILER_LAUNCHER=ccache" } }from which
cmake-tasksconstructs anoverseertask, so far so good. However, the following command gets escaped by overseer, and ends up being sent to the shell (bash) aswhich obviously does not work: the command is escaped out between single quotes
'...'.A simple way to simulate this failure is to run
bash -c "'echo test1' && echo test2"in a terminal, which givesbash: line 1: echo test1: command not foundThe patch in this PR removes escaping of the command, and leaves it for the arguments. This works in this case, but I am unsure if it might break other use cases.