On Tue, Jan 12, 2016 at 10:23 PM Per <pmknutsen gmail com> wrote:Is there a way I can run a command asynchronously in Gnome _javascript_?There is Gio.Subprocess, but it would be better to do all this without shelling out in the first place. It's not good to spawn hundreds of processes at once, synchronously or not! Here's some (untested) code that might help you:
This code still may have a problem; you'll want to avoid running hundreds of threads at the same time, all doing file I/O. To solve that, you could consider using recursion instead of a loop; start with an array of files that you want to process, pass it into a function with the above code, then in the callback to set_attributes_async(), pop the processed element off the array and do the same thing again until the array is empty. That way, the files will all be processed sequentially and asynchronously.