task :test do
cmd = "cd ~/ && pwd"
run "sudo su - -c '#{cmd}'" # works, but shows an error(that doesn't
rollback)
run "#{sudo} #{cmd}" # blows up on 'cd', triggers rollback
end
The error in the first case isn't the end of the world, but I'd rather it
go away if possible. Is there a better way to sudo up and then change
directories to run a command?
* executing "sudo su - -c 'cd ~/ && pwd'"
servers: ["stocks.example.com"]
[stocks.example.com] executing command
*** [err :: stocks.example.com] stdin: is not a tty
** [out :: stocks.example.com] /root
command finished in 78ms
* executing "sudo -p 'sudo password: ' cd ~/ && pwd"
servers: ["stocks.example.com"]
[stocks.example.com] executing command
*** [err :: stocks.example.com] sudo
*** [err :: stocks.example.com] :
*** [err :: stocks.example.com] cd: command not found
*** [err :: stocks.example.com]
command finished in 42ms
*** [deploy:update_code] rolling back
--
--
* You received this message because you are subscribed to the Google Groups
"Capistrano" group.
* To post to this group, send email to [email protected]
* To unsubscribe from this group, send email to
[email protected] 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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.