Aaaaaaaaaaand now I feel a bit ridiculous, because shortly after posting, I was chatting to some goys in IRC, and was pointed towards a better solution that is built right into SSHKit!
https://github.com/leehambley/sshkit/blob/master/EXAMPLES.md def within(directory, &block) (@pwd ||= []).push directory.to_s execute <<-EOTEST, verbosity: Logger::DEBUG if test ! -d #{File.join(@pwd)} then echo "Directory does not exist '#{File.join(@pwd)}'" 1>&2 false fi EOTEST yield ensure @pwd.pop end Sorry for the bad formatting, this is from https://github.com/leehambley/sshkit/blob/master/lib/sshkit/backends/abstract.rb and I pasted the code via my iPhone :) -- -- * You received this message because you are subscribed to the Google Groups "Capistrano" group. * To post to this group, send email to capistrano@googlegroups.com * To unsubscribe from this group, send email to capistrano+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en --- You received this message because you are subscribed to the Google Groups "Capistrano" group. To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.