GNOME Bugzilla – Bug 679896
Simplify Util.run()
Last modified: 2016-03-31 13:56:31 UTC
This function was mostly reimplementing run_in_thread() defined just above it so it wasn't very hard to reduce it to three lines.
Created attachment 218760 [details] [review] util: Add optional cancellable arg to run_in_thread
Created attachment 218761 [details] [review] util: Simplify run() Basically it now just launches run_sync() through run_in_thread().
Review of attachment 218761 [details] [review]: I actually was wondering why we are not using g_spawn_async there instead of spawning stuff in a thread ourselves. ::: src/util.vala @@ -464,2 @@ public async void exec (string[] argv, Cancellable? cancellable) throws GLib.Error { - SourceFunc continuation = exec.callback; No clue what exec.callback is? Is it something the caller can set?
Review of attachment 218761 [details] [review]: g_spawn_async doesn't exactly map to async style of GIO/Vala and hence is not so nice to use, especially if you want to (asynchornously) wait for the launched process to exit. That was the rationale *IIRC*. ::: src/util.vala @@ -464,2 @@ public async void exec (string[] argv, Cancellable? cancellable) throws GLib.Error { - SourceFunc continuation = exec.callback; https://live.gnome.org/Vala/Tutorial#Asynchronous_Methods No, it can't!
Attachment 218760 [details] pushed as ef7e5ce - util: Add optional cancellable arg to run_in_thread Attachment 218761 [details] pushed as ba8de1d - util: Simplify run()