WSL-DistroLauncher icon indicating copy to clipboard operation
WSL-DistroLauncher copied to clipboard

When the default user is defined, the wsl.conf is updated accordingly

Open crramirez opened this issue 5 years ago • 4 comments

crramirez avatar Oct 29 '20 18:10 crramirez

CLA assistant check
All CLA requirements met.

ghost avatar Oct 29 '20 18:10 ghost

  • The [user] section may not be available in wsl.conf in older Windows 10 versions. A Windows version check may be useful?
  • CreateProcess return value is not checked.
  • RunProcess can be a static function here.
  • WslApiLoader::WslLaunch may be used instead of RunProcess wrapper.

Biswa96 avatar Oct 29 '20 19:10 Biswa96

Hello @Biswa96,

Thank you for your comments. My answers:

  • The [user] section may not be available in wsl.conf in older Windows 10 versions. A Windows version check may be useful? Yes I will include that
  • CreateProcess return value is not checked. Yes, because I think that this can be ignored. But help me think, what should happen if it fails, show a warning to the user? Maybe
  • RunProcess can be a static function here. Ok
  • WslApiLoader::WslLaunch may be used instead of RunProcess wrapper. Ok, I didn't use it, and it was my first option but it runs the distro with the default user. The first time it is ok because the default one is root. But the second time it is a limited user that won't be able to modify wsl.conf. I could add a sudoers exception but I think it is too intrusive.

crramirez avatar Oct 29 '20 19:10 crramirez

@Biswa96 I made a code clean up to the PR; please check it. I figure that I addressed all your concerns.

It won't hurt to have [user] not available in older versions; WSL won't use it in older ones. But when the user upgrades Windows, it will be already there configured.

Regards, Carlos

crramirez avatar Jan 22 '22 22:01 crramirez