I just started to develop a webpage with RoR and when my create method inside my controller is called and an .exe file created with python and py2exe is executed the server suddenly stops without any exceptions. Can someone tell me why this happens? (The running server is a localhost:3000).
The create method:
@cotizador = Cotizador.new(cotizador_params)
if @cotizador.save
exec("#{Rails.root}/app/assets/forcot/dist/ksnf.exe")
The .exe file that I created with python changes .docx files but no log file is generated.
Hope this helps!
From the docs of Kernel#exec
:
Replaces the current process by running the given external command, [...].
That means your server process is stopped and replaced with the exe
and therefore your server cannot answer anymore because it simply does run anymore.
Just use Kernel#system
instead:
system("#{Rails.root}/app/assets/forcot/dist/ksnf.exe")
Have a look at this answer about various ways do system calls in Ruby and their differences.