Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Make app templates sync output back immediately?

#2047

Currently app templates use backticks to execute external commands such as git clone. With backticks the output gets buffered and then sent to nirvana.

Is there any particular reason for using backticks and not syncing stdout? Maybe some OS related thing?

Otherwise I feel it would be much nicer to directly report back the external command's output to the shell:

STDOUT.sync = true

system "git clone ..."

I've attached a patch for the git adapter. If the change would be acceptable for other app template commands as well I'll change that accordingly.

Reported by Sven Fuchs · February 22nd, 2009 @ 11:18 PM

State: resolved
Milestone: 2.x
Assigned to: Pratik Pratik
Importance: none

Activity

  1. DHH
    DHH
    • Assigned user set to Pratik

    February 27th, 2009 @ 02:01 PM

  2. Pratik
    Pratik
    • State changed from new to incomplete

    Looks good. But I think we should change all the instances of with a single patch.

    Thanks.

    May 18th, 2009 @ 09:54 PM

  3. Sven Fuchs
    Sven Fuchs

    Pratik, you mean "all the instances of backticks" ... where? allover Rails? I could look into that, too, of course.

    July 7th, 2009 @ 09:38 AM

  4. Sven Fuchs
    Sven Fuchs
    • State changed from incomplete to open

    Ok, I've now reworked that patch to use system() for all the git commands in that file.

    I've again applied the patch and ran "rails app -m template.rb" using it. That template contained a git clone command with a rather large repository. The command's output from Github was immediately sync'ed back to my shell so I could watch the clone command's status.

    Will change the ticket status to "open" again.

    August 2nd, 2009 @ 06:15 PM

  5. Sven Fuchs
    Sven Fuchs

    Also deleted the first version patch to avoid any confusion.

    August 2nd, 2009 @ 06:16 PM

  6. José Valim
    José Valim

    Pratik, I will handle it. It will include changes to thor.

    Thanks Sven!

    August 2nd, 2009 @ 09:21 PM

  7. Sven Fuchs
    Sven Fuchs

    Changes to Thor? Is Thor part of the app template system in Rails?

    August 2nd, 2009 @ 11:57 PM

  8. José Valim
  9. José Valim
    José Valim

    Already fixed this on Thor. Rails 3 will have this fixed as soon as I update the vendored version.

    August 3rd, 2009 @ 06:49 AM

  10. Sven Fuchs
    Sven Fuchs

    Cool! :)

    Can we apply it to 2.3.x, too?

    August 3rd, 2009 @ 07:12 AM

  11. José Valim
    José Valim

    I cannot apply to Rails 2.3, but it would be a good idea. I also replaced run() to use system instead of backticks, everything appears to be great.

    August 3rd, 2009 @ 07:14 AM

  12. Repository
    Repository
    • State changed from open to resolved

    (from [5a0e2959117e29e6836b9f611d6ba1d3260702b7]) Make app template git adapter sync back output immediately by using system() instead of backticks [#2047 Make app templates sync output back immediately? state:resolved]

    Signed-off-by: Pratik Naik pratiknaik@gmail.com
    http://github.com/rails/rails/commit/5a0e2959117e29e6836b9f611d6ba1...

    August 5th, 2009 @ 07:42 PM