GithubHelp home page GithubHelp logo

Comments (4)

jaknz avatar jaknz commented on May 25, 2024

I found the --debug flag in the code for slightly more info:

[debug:/usr/bin/wslview] Showing debug output.
[debug:/usr/bin/wslview] source default setting
[debug:/usr/bin/wslview] /etc/wslu/conf found, sourcing
ERROR: Registry editing has been disabled by your administrator.
[debug:/usr/bin/wslview] distro: debian
[debug:/usr/bin/wslview] lname: https://github.com
[debug:/usr/bin/wslview] WSLVIEW_DEFAULT_ENGINE: powershell
ERROR: Registry editing has been disabled by your administrator.
[debug:/usr/bin/wslview] properfile_full_path:
[debug:/usr/bin/wslview] validating whether if it is a link
[debug:/usr/bin/wslview] It is a link
[debug:/usr/bin/wslview] cmd: "https://github.com"
[debug:/usr/bin/wslview] winps_exec: called with command Start "https://github.com"
ERROR: Registry editing has been disabled by your administrator.
/usr/bin/wslview: line 267: [: : integer expression expected
Parameter format not correct - ""
Cannot find an overload for "GetEncoding" and the argument count: "0".
At line:1 char:59
+ ... ing]::UTF8; [Console]::InputEncoding = [System.Text.Encoding]::GetEnc ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

/usr/bin/wslview: line 270: [: : integer expression expected

from wslu.

jaknz avatar jaknz commented on May 25, 2024

I've been walking through the code to see what can be done without checking the registry. Looks like the biggest offender is getting the Windows build number. I've found a reliable fallback which I've patched into my installed version, and it's much quieter, but not completely error-free.

build=$("$(interop_prefix)$(sysdrive_prefix)"/Windows/System32/WindowsPowerShell/v1.0/powershell.exe /c "(gcm wsl).Version.Build" | sed -e 's|\r||g')

from wslu.

jaknz avatar jaknz commented on May 25, 2024

It also looks like the codepage variable isn't being set which is causing the Powershell errors. This can also be handled by (ironically) calling Powershell as above:

cp=$("$(interop_prefix)$(sysdrive_prefix)"/Windows/System32/WindowsPowerShell/v1.0/powershell.exe /c "Get-ItemPropertyValue HKLM:\SYSTEM\CurrentControlSet\Control\Nls\CodePage -Name OEMCP" | sed -e 's|\r||g')

from wslu.

jaknz avatar jaknz commented on May 25, 2024

And with those two patches, I'm not hitting reg.exe, and thus getting a clean run. Note that I added a couple of debug_echo commands to check that I'm getting the correct build and codepage with these new methods.

wslview --debug "http://github.com"
[debug:/usr/bin/wslview-patch] Showing debug output.
[debug:/usr/bin/wslview-patch] source default setting
[debug:/usr/bin/wslview-patch] /etc/wslu/conf found, sourcing
[debug:/usr/bin/wslview-patch] build: 22621
[debug:/usr/bin/wslview-patch] distro: debian
[debug:/usr/bin/wslview-patch] lname: http://github.com
[debug:/usr/bin/wslview-patch] WSLVIEW_DEFAULT_ENGINE: powershell
[debug:/usr/bin/wslview-patch] build: 22621
[debug:/usr/bin/wslview-patch] properfile_full_path:
[debug:/usr/bin/wslview-patch] validating whether if it is a link
[debug:/usr/bin/wslview-patch] It is a link
[debug:/usr/bin/wslview-patch] cmd: "http://github.com"
[debug:/usr/bin/wslview-patch] winps_exec: called with command Start "http://github.com"
[debug:/usr/bin/wslview-patch] build: 22621
[debug:/usr/bin/wslview-patch] codepage: 850

from wslu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.