3

I have a Rails app hosted on a linux server. I need to generate a key event, so I'm using a linux program to accomplish this (xdotool). My question is, if the end user doesn't have linux (or just doesn't have xdotool) will this command still work, since it is being executed by the server?

2 Answers2

0

Yes, it will work, because the action which will be calling the linux program, will be invoked on your linux machine and not on user machine. So it, wouldnt be a problem at all. You can have a look at link for various methods of calling native code from ruby script(in your case, it would be a controller action, or a module) however you prefer.

Community
  • 1
  • 1
Sudipta Mondal
  • 2,550
  • 1
  • 19
  • 20
  • are you sure, xdotool targets a specific window, i dont think it can target a client user's window –  Nov 15 '15 at 07:42
  • What exactly do you want to achieve by this xdotool? Maybe I can help you figure out a solution – Sudipta Mondal Nov 15 '15 at 17:47
  • @SudiptaMondai basically I make a call from a controller to xdotool with something that generates a key event/typing (e.g xdotool type username) –  Nov 15 '15 at 17:49
  • Any reason why you can't take the output of xdotool and send it to browser? – Sudipta Mondal Nov 15 '15 at 17:51
0

The linux command will be executed under the context of the rails app, not the user, so as long as the rails app owner has the privileges, it should be fine.

rii
  • 1,578
  • 1
  • 17
  • 22
  • im trying to call xdtool to enter text on the end-user's web browser, so that wont work here right? –  Nov 15 '15 at 18:18
  • Hmmm, I am not sure now. This might or might not help, someone wrote a wrapper for xdotools about 5 years ago: https://rubygems.org/gems/xdo could be a starting point. – rii Nov 15 '15 at 20:13