Forum: Ruby on Rails running console commands in rails

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Fbc9e284984a357bf1c0229bed15b072?d=identicon&s=25 Stewart (Guest)
on 2009-02-22 13:14
(Received via mailing list)
Hey,

how can i run console commands form my rails app. I have tried using
backticks. eg

result = `svn checkout <url> <path>`

They work fine when i run the sciprt from the command line with

ruby something.rb

but when the same script is run form my rails app nothing happens. It
seems the commands are ignored.  Does anyone know a different way of
doing this with out backticks or a solution for getting around this
problem.

Thanks in advance,
Stewart
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-02-22 13:29
(Received via mailing list)
On Feb 22, 3:12 am, Stewart <stewart.mathe...@gmail.com> wrote:
>
> but when the same script is run form my rails app nothing happens. It
> seems the commands are ignored.  Does anyone know a different way of
> doing this with out backticks or a solution for getting around this
> problem.
>
Have you looked at what result is when it doesn't work ? Could it just
be that the working directory isn't what you expect it to be and so
the checkout happens somewhere else? Another possibility is that the
shell spawned to execute your command somehow inherits a different
environment (eg $PATH) and so it can't find the svn command.

Fred
This topic is locked and can not be replied to.