2

I'm trying to do something like this

 listen_for /turn on the living room lights/i do
    system('/usr/bin/tdtool -n 1')
    say "Your lights is now turned on"

    request_completed
  end

but the command inside system does not run, instead I get the following message:

Turning on device 1, - The method you tried to use is not supported by the device

If I run the exact same method from the shell it works great, any ideas?

mu is too short
  • 426,620
  • 70
  • 833
  • 800
marcus
  • 9,616
  • 9
  • 58
  • 108
  • I have also tried to create a test.rb file with a single line of code, system "/usr/bin/tdtool -n 1" and then execute it with rvmsudo ruby test.rb but that does not work either. But if i run the command from the terminal it works great. – marcus Nov 29 '11 at 13:50

1 Answers1

0

That's a weird one.

Try system('./usr/bin/tdtool -n 1')

--> notice the dot (.) before the first slash (/)

If the above didn't succeed..Perhaps you need the ('\') slash instead of ('/')..

I've just tested this on my machine..

system("cls")       

system("cd\\")    

system("cd c:\\program files\\mysql\\mysql server 5.5\\bin")

system("mysql.exe -u root -p")

Using the double slash '\\' as '\' is the escape character in Ruby. Hope that helps!

Xwris Stoixeia
  • 1,831
  • 21
  • 22