Skip to content

Commit

Permalink
fix: [#291] allow disable reading from registry
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick330602 committed Dec 31, 2023
1 parent e52ebcf commit b08c0b8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
4 changes: 4 additions & 0 deletions docs/wslu.7
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ unsupported feature (for your Windows 10 build)
.TP
.B 40
Unknown system input.
.SH CONFIGURATION
.TP
.B WSLVIEW_DEFAULT_ENGINE
control whether to enable the chcp workaround for powershell. By default it is true; if you encounter any PowerShell issues, you can try to disable it.
.SH BUG
Report bugs to <https://github.com/wslutilities/wslu/issues>;
For Ubuntu specific bugs, report to <https://bugs.launchpad.net/ubuntu/+source/wslu>.
Expand Down
4 changes: 4 additions & 0 deletions src/etc/conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# wslu: control whether to enable the chcp workaround for powershell.
# By default it is true; if you encounter any PowerShell issues, you can try to disable it.
WSLU_POWERSHELL_CHCP_WORKAROUND=true

# wslfetch: the sections of info from wslsys to show in wslfetch.
# Available options:
# windows-install-date
Expand Down
4 changes: 4 additions & 0 deletions src/etc/user/conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# wslu: control whether to enable the chcp workaround for powershell.
# By default it is true; if you encounter any PowerShell issues, you can try to disable it.
# WSLU_POWERSHELL_CHCP_WORKAROUND=true

# wslfetch: the sections of info from wslsys to show in wslfetch.
# Available options:
# windows-install-date
Expand Down
20 changes: 13 additions & 7 deletions src/wslu-header
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,19 @@ function chcp_com {

function winps_exec {
debug_echo "winps_exec: called with command $*"
wslutmpbuild="$(wslu_get_build)"
cp="$(cat "${wslu_state_dir}"/oemcp)"
[ "$wslutmpbuild" -ge $BN_OCT_NINETEEN ] || chcp_com "$cp"
"$(interop_prefix)$(sysdrive_prefix)"/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; [Console]::InputEncoding = [System.Text.Encoding]::GetEncoding($cp); $*"
EXIT_STATUS=$?
[ "$wslutmpbuild" -ge $BN_OCT_NINETEEN ] || chcp_com 65001
return $EXIT_STATUS
if [[ "$WSLU_POWERSHELL_CHCP_WORKAROUND" == "true" ]]; then
wslutmpbuild="$(wslu_get_build)"
cp="$(cat "${wslu_state_dir}"/oemcp)"
[ "$wslutmpbuild" -ge $BN_OCT_NINETEEN ] || chcp_com "$cp"
"$(interop_prefix)$(sysdrive_prefix)"/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; [Console]::InputEncoding = [System.Text.Encoding]::GetEncoding($cp); $*"
EXIT_STATUS=$?
[ "$wslutmpbuild" -ge $BN_OCT_NINETEEN ] || chcp_com 65001
return $EXIT_STATUS
else
"$(interop_prefix)$(sysdrive_prefix)"/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "$*"
EXIT_STATUS=$?
return $EXIT_STATUS
fi
}

function cmd_exec {
Expand Down

0 comments on commit b08c0b8

Please sign in to comment.