Ok, I see how I can make run and sudo execute in a specified directory. In open_channels in command.rb if I append "cd /tmp &&" to the cmd, inside the quotes that should preserve the semantics you are using, a missing directory will cause an error and not issue the command. A non zero returned from the command would still raise an exception. The commands execed would now be:
sh -c "cd /tmp && touch foo" sh -c "cd /tmp && sudo touch foo" What I don't get and am not sure how to track down is how to add the chdir to the DSL and have it accomplish this. Had you not suggested above I probably would have added a dir option or some such nonsense but what you suggest seems a very natural way of accomplishing it. I see the DSL actions under configuration/actions/. I am just not sure what the quickest way of getting the gist of how these are interpreted. Any pointers? Oh the other thing I may be overlooking is I am only considering run and sudo. I am unaware of any other actions this may make sense for. Maybe it makes sense for get and put but I would be inclined to say that it doesn't given the semantics of scp (either absolute paths or paths relative to the users home dir). Austin On Mar 13, 1:09 pm, Jamis Buck <[EMAIL PROTECTED]> wrote: > There's no support for that, but it would make an interesting > capistrano extension. Maybe something like: > > chdir "/opt/src/ruby" do > run "./configure" > run "make" > end > > If anyone has a hankering to hack something like that together, it > could be a fun project. > > - Jamis > > On Mar 13, 2008, at 11:40 AM, godber wrote: > > > > > Howdy, > > Anyone know of a way to set a working directory on the remote machine > > so that run and sudo work in the desired directory? > > > For instance, I am doing this a lot: > > > run "cd /opt/src/ruby && ./configure" > > run "cd /opt/src/ruby && make" > > > but would prefer to do something like this: > > > DIR="/opt/src/ruby" > > run "./configure" > > run "make" > > > Austin > > > > > > smime.p7s > 3KDownload --~--~---------~--~----~------------~-------~--~----~ To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/capistrano -~----------~----~----~----~------~----~------~--~---
