Stephen,

I've considered this, but I don't want this behavior in general. For instance, consider the long-running process that emits some progress indicator character, like a '.', each time some increment of the operation finishes. A newline may not be emitted for many minutes, but you'd like to see some progress being made.

For an action that you know will not behave like that, though, it might be a nice option to specify that you want line buffering. Perhaps as an option to run:

  run "some command", :buffer => true do |ch, stream, out|
    ...
  end

Thoughts?

- Jamis

On Oct 27, 2006, at 11:49 AM, Stephen Haberman wrote:


Hi,

I have not been using capistrano for a whole lot just yet, but for
executing the few remote commands I've been doing, I've found buffering
the return output per line to be a lot easier to read:

    # Buffer capistrano output per line
    Capistrano::Actor.default_io_proc = Proc.new do |ch, stream, out|
      ch[stream] ||= ''
      ch[stream] << out
      if out[-1..-1] == "\n"
        level = stream == :err ? :important : :info
ch[:actor].logger.send(level, ch[stream], "#{stream} :: #{ch [:host]}")
        ch[stream] = ''
      end
    end

I must admit its been a few weeks since I wrote this, but as I recall it
turned the output I was seeing from:

    out :: host1 Restarting daemon
    out :: host1 [OK]
    out :: host1 ...
    out :: host2 Restarting daemon
    out :: host2 [OK]
    out :: host2 ...

To just:

    out :: host1 Restarting daemon [OK]
    out :: host2 Restarting daemon [OK]

I would almost suggest this as a patch, but just because its desirable
for my situation, I don't know if its desirable for all situations.

- Stephen


--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to capistrano- [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