running console commands in rails

18 views
Skip to first unread message

Stewart

unread,
Feb 21, 2009, 10:12:49 PM2/21/09
to Ruby on Rails: Talk
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

Frederick Cheung

unread,
Feb 22, 2009, 7:28:22 AM2/22/09
to Ruby on Rails: Talk
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

> Thanks in advance,
> Stewart
Reply all
Reply to author
Forward
0 new messages