On my Rails-based website, I’d like a user to be able to input a URL, which my server downloads using the Unix command wget with the recursive option. My server then zips those downloaded files along with some files already on the server, and sends the zip to the user by using the Rails command send_file.
Now, I’m worried that the send_file will be executed before the wget and zipping finish their job. How do I make sure that sending the file occurs only after the downloading and zipping finish? Will this approach work, or should I take an another approach?
How are you interacting with wget from within the application. If you’re using ruby’s backtick or similar, it should wait until the command exits