# Running console commands in rails

**URL:** <https://www.ruby-forum.com/t/running-console-commands-in-rails/161023>\
**Category:** Rails\
**Created:** [February 22, 2009, 1:14pm UTC](https://www.ruby-forum.com/t/running-console-commands-in-rails/161023 "2009-02-22T13:14:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stewart](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90db22/32.png) [@Stewart](https://www.ruby-forum.com/u/Stewart)\
**Post date:** [February 22, 2009, 1:14pm UTC](https://www.ruby-forum.com/t/running-console-commands-in-rails/161023/1 "2009-02-22T13:14:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Stewart](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90db22/32.png) [@Stewart](https://www.ruby-forum.com/u/Stewart)\
**Post date:** [February 22, 2009, 1:29pm UTC](https://www.ruby-forum.com/t/running-console-commands-in-rails/161023/2 "2009-02-22T13:29:37Z")

</div>

On Feb 22, 3:12 am, Stewart [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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
