Josh, the first one isn't an error, it's just output writted to stderr. That's absolutely expected, as stdin of the process is not a TTY (i.e not an interactive terminal, it's a Capistrano environment )
You'll solve both of these problems if you make sure that your user can passwordlessly sudo, or stop using sudo all together. Lee Hambley -- http://lee.hambley.name/ +49 (0) 170 298 5667 On 29 June 2013 22:41, Josh Sharpe <josh.m.sha...@gmail.com> wrote: > 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 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. > > > -- -- * 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.