Rails doesn't wait for script to finish

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • meihome
    New Member
    • May 2007
    • 2

    Rails doesn't wait for script to finish

    I have a pretty long process (40 seconds) script.
    It is kicked off from one controller action from web browser.

    The problem is, the Rails does not wait until the process is done. It actually stops the process at about 5 seconds, and goes to the next step.

    def _run_script (my_id)
    system ("my_long_runni ng_script.sh")
    redirect_to :action =>'edit', :id => my_id
    end

    I tried Process , wait. It still doesn't work.

    If I run the action from the controller unit test, it can wait for finishing though.

    Any way to solve it ?

    Thanks
    ~Andrew Che
  • meihome
    New Member
    • May 2007
    • 2

    #2
    It turned out to be that my script exit halfway because of error.

    Rail is OK :-)

    Originally posted by meihome
    I have a pretty long process (40 seconds) script.
    It is kicked off from one controller action from web browser.

    The problem is, the Rails does not wait until the process is done. It actually stops the process at about 5 seconds, and goes to the next step.

    def _run_script (my_id)
    system ("my_long_runni ng_script.sh")
    redirect_to :action =>'edit', :id => my_id
    end

    I tried Process , wait. It still doesn't work.

    If I run the action from the controller unit test, it can wait for finishing though.

    Any way to solve it ?

    Thanks
    ~Andrew Che

    Comment

    Working...