I do a lot of inserts (duration about 3 min) and would like to show a
progressbar for the user during this inserts. I tried out to do it with threads, but without a success. Also forking a process doesn't work (Windows XP). Somebody has an idea?
I had to do something similar recently. You can exec "start whatever" in windows and it will start a new process with the command line you provide (rake or ruby script/runner for example). The option /B will even hide the window for the new process.
Regarding to the communication back to the user, I did it by creating a "semaphore" file at launching time and deleting it at completion. Meanwhile I had a small ajax magic querying every n seconds back to the server and just checking if the semaphore was still alive. I was also showing a timestamp back to the users so they could know everything was peachy on the server side.
I know more solid solutions like Drb are available and recommended, but this one doesn't need any installation/monitoring and it works fine for simple tasks.