Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detach config #74

Merged
merged 3 commits into from
Dec 6, 2021
Merged

Detach config #74

merged 3 commits into from
Dec 6, 2021

Conversation

psmolkin
Copy link
Contributor

Hi!
Thanks for a great job firstly!
My little little improvments for this project:

  • Detach config and make it auto-creatable
  • Disabled loading PS profile to speed up startup

* Some little improvments
distro/scripts/startup.sh Show resolved Hide resolved
mkdir -p "$USERPROFILE/wsl-vpnkit/"
if [ ! -f "$CONF_PATH" ]; then
cp /app/defaults.conf "$CONF_PATH"
fi
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To minimize the changes automatically made by the script to the user's machine, I would rather this to be added as part of the startup text so users could manually create the config file. That will remove the need to care about migrating the config if something ever changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. The main motivation was to separate the evaluated variables from the constants.

distro/scripts/startup.sh Outdated Show resolved Hide resolved
@psmolkin
Copy link
Contributor Author

psmolkin commented Dec 3, 2021

Updated as per comments above

wsl-vpnkit Outdated Show resolved Hide resolved
@psmolkin psmolkin changed the title Detach config and make it auto creatable Detach config Dec 4, 2021
@psmolkin
Copy link
Contributor Author

psmolkin commented Dec 4, 2021

What do you think about change powershell.exe call to cmd.exe?

time -f '%e' ash -c  "wslpath \$(cmd.exe /V:OFF /C 'echo | set /p t=%USERPROFILE%' 2>/dev/null)"
/mnt/c/Users/psmolkin
0.05

time -f '%e' ash -c "wslpath \$(powershell.exe -NoLogo -NoProfile -c 'Write-Host -NoNewline \$env:USERPROFILE')"
/mnt/c/Users/psmolkin
0.96

Note: echo | set / p t =% USERPROFILE% is used instead of echo% USERPROFILE% to prevent messy output with CRLF and \ 0 characters

@psmolkin
Copy link
Contributor Author

psmolkin commented Dec 4, 2021

as well as

time -f '%e' taskkill.exe /F /T /IM wsl-vpnkit.exe || :
SUCCESS: The process with PID 9072 (child process of PID 10816) has been terminated.
0.42
time -f '%e' powershell.exe -NoProfile -c 'Stop-Process -Force -Name wsl-vpnkit -ErrorAction SilentlyContinue'
0.97

@sakai135 sakai135 merged commit 598b43a into sakai135:main Dec 6, 2021
@sakai135
Copy link
Owner

sakai135 commented Dec 6, 2021

@psmolkin Thanks, those improvements do seem worthwhile too if you want to open a separate PR.

@psmolkin psmolkin deleted the config-detach branch December 14, 2021 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants