Bug: within(directory){ execute(string) } should either 'just work' or 'boom'
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start by reading the existing within and execute entry points and the documentation around them, then reproduce the silently ignored directory behavior and the failing-directory contrast described here. Resolve the design choice between making string commands work, raising, or removing within, and document and test the selected behavior.
Written by the indexing model from the issue text.
Description
docs aren't good enough to explain the design choice IMHO - just check
stackoverflow...
one solution is just to fix it - use shellwords to properly escape the command
require 'shellwords'
def execute(*args, &block)
if args.first.is_a?(String)
command = Shellwords.escape(args.first)
end
# ...
end
otherwise raise an exception
def execute(*args, &block)
if args.first.is_a?(String) and inside_within?
raise "don't do that"
end
# ...
end
the current behavior of doing
within directory do # silently ignored
execute command
end
just isn't POLS - the point of a library like cap is to be able to re-use code
but, currently, each and every use must re-invent 'cd into a (properly escaped
directory) and run commands', including handling the fact that
within(does_not_exist) do # raises
end
execute "#{ does_not_exist }; command.sh" # reports a failed exit status that leads to debugging which part failed
a final solution would be to remove the 'within' API since it sometimes works,
and sometimes does not, issuing no exception nor warning
- Dominant language
- Ruby
- Stars
- 1.2k
- Forks
- 257
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from capistrano/sshkit
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
capistrano/sshkit#563 · 6 reactions ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
capistrano/sshkit#562 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
capistrano/sshkit#554 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
capistrano/sshkit#543 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
capistrano/sshkit#518 · 1 comment ·
All issues in capistrano/sshkit
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
simp/pupmod-simp-simp#395 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
simp/pupmod-simp-rsyslog#219 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
simp/pupmod-simp-pupmod#256 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
simp/pupmod-simp-sudo#150 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100