WhitewaterFoundry / Fedora-Remix-for-WSL

Fedora Remix for Windows Subsystem for Linux.
Other
716 stars 51 forks source link

Don't call cmd.exe if not needed #137

Closed ryncsn closed 2 years ago

ryncsn commented 2 years ago

Hi, I found starting new subshell in WSL2 with this Fedora remix is really slow, and found the reason is caused by this 00-remix.sh, I tried to fix it, as long as WIN_HOME is not a variable that changes from time to time, this fix should be valid, please have a look.

cmd.exe is called in 00-remix.sh to get and set the WIN_HOME variable.

When spawning multiple shell instances inside a already running interactive shell, this cmd.exe call slows down the startup speed by a lot, skip this call if WIN_HOME is already set.

crramirez commented 2 years ago

Thank you for your contribution. It looks like great

leonbloy commented 2 years ago

This almost fixes my issue https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL/issues/129 but with two caveats:

  1. I think it's not foolproof to rely on the definition of $WIN_HOME It will not be available if setting (as was my case)

    [interop]
    appendWindowsPath=false

    I would be better to define some ad-hoc env variable like WSL_00_REMIX_DONE=1 or something like that

  2. We want to avoid the unnecesary heavy tasks in child shells. I think it would be better to except, not only the block that starts with the comment # Check if we have Windows Path but also the lines

setup_display
# if dbus-launch is installed then load it
if (command -v dbus-launch >/dev/null 2>&1); then
  eval "$(timeout 2s dbus-launch --auto-syntax)"
fi