Rewrite DesktopExecParser to be async
Open, Needs TriagePublic

Description

Quoted from D29385#662496

Ahhh yes correct. Seeming as these jobs are now async (unlike KRun IIRC?), it isn't a problem that resultingArguments makes several blocking calls to the KIOFuse daemon?

Some of KRun was async too ("new KRun" was async, the static methods like runUrl and others were not).
The blocking calls in resultingArguments() don't make things worse for OpenUrlJob than it was for KRun, but of course the fact that the job is async is an opportunity to do everything async.
The problem is that we can't get rid of KRun just yet....

Async on top of sync works -- but still blocks the GUI thread so it's not perfect. Sync on top of async requires awful eventloop hacks which are often the source of nasty bugs.

Solution 1: we write an async version of DesktopExecParser, keeping the existing one for KRun.
Solution 2: we wait until KRun is gone (KF6) to make DesktopExecParser async.

(I'm skipping non-solutions like event loop hacks in KRun or using the fact that nobody seems to really care for the PIDs or "bool success" returned by KRun so we could just make KRun "fire and forget" the underlying jobs and always return success).

Basically this means rewriting DesktopExecParser as a KJob. Are you up for it? ;-)
I can provide guidance, but I really care about FUSE enough myself to test a rewrite if I'd have to write it.
Or I write, you test ;)

feverfew created this task.Dec 15 2020, 2:00 PM
alex added a subscriber: alex.Aug 9 2021, 5:35 PM

One could just provide a std::function callback parameter and call the function with the result once it is finished.

In the sync variant we could use a QEventLoop for the time being.

alex moved this task from Backlog to Optional/Low Priority on the KF6 board.Sep 10 2021, 3:26 PM