Browse Source

feat: win unicode flag (#590)

James Read 1 year ago
parent
commit
c20eea29cd
1 changed files with 8 additions and 1 deletions
  1. 8 1
      service/internal/executor/executor_windows.go

+ 8 - 1
service/internal/executor/executor_windows.go

@@ -6,6 +6,7 @@ package executor
 import (
 	"context"
 	"os/exec"
+	"os"
 )
 
 func (e *Executor) Kill(execReq *InternalLogEntry) error {
@@ -13,5 +14,11 @@ func (e *Executor) Kill(execReq *InternalLogEntry) error {
 }
 
 func wrapCommandInShell(ctx context.Context, finalParsedCommand string) *exec.Cmd {
-	return exec.CommandContext(ctx, "cmd", "/C", finalParsedCommand)
+	winCodepage := os.Getenv("OT_WIN_FLAG_U")
+
+	if winCodepage == "0" {
+		return exec.CommandContext(ctx, "cmd", "/C", finalParsedCommand)
+	} else {
+		return exec.CommandContext(ctx, "cmd", "/u", "/C", finalParsedCommand)
+	}
 }