Skip to content

Commit

Permalink
Merge pull request rancher-sandbox#8177 from mook-as/wsl-utf8
Browse files Browse the repository at this point in the history
WSL-helper: Use UTF8 when interrogating WSL
  • Loading branch information
jandubois authored Feb 4, 2025
2 parents de86c20 + 1120e97 commit 3b172c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 31 deletions.
11 changes: 5 additions & 6 deletions src/go/wsl-helper/pkg/wsl-utils/run_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"io"
"os"
"os/exec"
"path/filepath"

Expand Down Expand Up @@ -55,12 +56,10 @@ func (r *wslRunnerImpl) run(ctx context.Context, args ...string) error {
}
wslPath := filepath.Join(systemDir, "wsl.exe")
cmd := exec.CommandContext(ctx, wslPath, args...)
if r.stdout != nil {
cmd.Stdout = &utf16Writer{r.stdout}
}
if r.stderr != nil {
cmd.Stderr = &utf16Writer{r.stderr}
}
cmd.Env = append(cmd.Env, os.Environ()...)
cmd.Env = append(cmd.Env, "WSL_UTF8=1")
cmd.Stdout = r.stdout
cmd.Stderr = r.stderr
cmd.SysProcAttr = &windows.SysProcAttr{HideWindow: true}
err = cmd.Run()
if err != nil {
Expand Down
25 changes: 0 additions & 25 deletions src/go/wsl-helper/pkg/wsl-utils/utf16writer_windows.go

This file was deleted.

0 comments on commit 3b172c6

Please sign in to comment.