소스 검색

feat: win unicode flag (#590)

James Read 1 년 전
부모
커밋
c20eea29cd
1개의 변경된 파일과 8개의 추가작업 그리고 1개의 파일을 삭제
  1. 8 1
      service/internal/executor/executor_windows.go

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

@@ -6,6 +6,7 @@ package executor
 import (
 import (
 	"context"
 	"context"
 	"os/exec"
 	"os/exec"
+	"os"
 )
 )
 
 
 func (e *Executor) Kill(execReq *InternalLogEntry) error {
 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 {
 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)
+	}
 }
 }