Closed lindhe closed 1 year ago
Hi @lindhe! In theory, you can source it asynchronously, but since no state is shared between the worker (subshell) and the main shell, you would need to serialize and transfer that state between them which would be quite inefficient. 😄
There's still something that can be done, I'd say you have two options:
sched
to delay the sourcing until after your shell is ready (see example)An example of delaying execution/source until after the shell is ready:
doit() { export MYENV=1; sleep 5; }
sched +1 doit
Notice that I've added a sleep to demonstrate that this scheduled task will lock up your shell until it's done, but it's a solid option to defer some work for later.
Thanks for the input! This sounds like quite an adventure, but perhaps I'll give it a shot some day I feel a little bit too cooky. :D
Hi!
I would like to source my autocompletion asynchronously. Is that possible with your framework? I tried to do so, but it doesn't seem to work. I guess functions run as subshells and that makes it hard to source things?
Cheers! :)