Ruby on Rails Tuesday, October 13, 2015



On Tuesday, October 13, 2015 at 12:56:28 PM UTC+1, Sam S wrote:
Inside the controller the ruby script is run with  the **exec** command.

     script_exec = exec("ruby /Code/AttendanceReport/attn/bin/scripts/Spreadsheet_proper.rb '#{city}' '#{date1}' '#{date2}'")


 
exec replaces the current process, so this is not surprising
 

The above approach kills the rails server and doesn't execute the ruby script. And hence I used

     script_exec = %x{ruby /Code/AttendanceReport/attn/bin/scripts/Spreadsheet_proper.rb '#{city}' '#{date1}' '#{date2}' }
     
          script_exec = system("ruby /Code/AttendanceReport/attn/bin/scripts/Spreadsheet_proper.rb '#{city}' '#{date1}' '#{date2}'")

The above **%x** and **system** approaches also fail when run rails server is started with -d. But it does work when the rails server is normally.



In what way do they fail?  

Fred

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a96a50b4-4bc1-4d99-a1d8-85cf187e489e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment