The escaping is there so that commands like this:

  run(<<-CMD)
    if [ some_condition ];
    then
      do_something
      do_another_thing
    fi
  CMD

Get translated into a single line and passed through to the remote host correctly. I'm pretty sure there are tests for that case, so if you change it and the tests all still pass, then you're probably ok. :)

- Jamis

On Apr 10, 2008, at 10:56 AM, Brian Hartin wrote:

I'd like to keep my task definitions within deploy.rb, if possible.  I
can open the Command class in deploy.rb, if need be.

In what situation would we want the '\\\', anyway?  "a\\\b" gets
changed to:

a\
b

Would I break anything by changing "\\\n" to "\\n" in Command#process!

Thanks for your help,

Brian


On Apr 10, 11:34 am, Jamis Buck <[EMAIL PROTECTED]> wrote:
I suspect that's breaking because your line break is inside a quoted
string...and capistrano's escaping is too naive to understand that.
You could put the command in a script and execute the script, thereby
foiling cap's escaping logic.

- Jamis

On Apr 10, 2008, at 10:23 AM, Brian Hartin wrote:



In line 24, we have

@command = command.strip.gsub(/\r?\n/, "\\\n")

If I have a remote command that includes line breaks, e.g. "echo - e 'a
\nb' | foo' it will translate it to:

echo -e 'a\\\nb' | foo

Which fails. If I change that line in Process to use "\\n", or to use
'\\\n' (single quotes), it works.  It also works if I use non-
interpolated strings in my command, but that is ugly.  Am I missing
something or should "\\\n" be "\\n"?

Thanks,

Brian Hartin



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
-~----------~----~----~----~------~----~------~--~---


Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to