Guest User

Untitled

a guest
Nov 23rd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. ## original paste
  2. fp = open("/dev/null","w")
  3. run("#{request[:command]}", :stdout => fp, :stderr => fp)
  4.  
  5. ## full action
  6.  
  7. action "start_daemon" do
  8. validate :command, String
  9.  
  10. child = fork do
  11. # this the child run command
  12. fp = open("/dev/null","w")
  13. run("#{request[:command]}", :stdout => fp, :stderr => fp)
  14. end
  15. # back in father, return data
  16. Process.detach(child)
  17. reply[:data][:pid] = child
  18. end # end of start_daemon
Add Comment
Please, Sign In to add comment