fix(修复问题): 修复运行时弹出WSL命令行

This commit is contained in:
xiaoqidun 2022-11-22 14:41:12 +08:00
parent 2bcaa7d166
commit 476779ebce

View File

@ -4,8 +4,10 @@ import (
"flag" "flag"
"github.com/xiaoqidun/gowsl" "github.com/xiaoqidun/gowsl"
"log" "log"
"os"
"strings" "strings"
"sync" "sync"
"syscall"
) )
func main() { func main() {
@ -32,6 +34,10 @@ func exec(done *sync.WaitGroup, distro string) {
return return
} }
cmd := gowsl.Command(distro, "/bin/bash") cmd := gowsl.Command(distro, "/bin/bash")
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
if err := cmd.Run(); err != nil { if err := cmd.Run(); err != nil {
log.Printf("%v cmd run err: %v", distro, err) log.Printf("%v cmd run err: %v", distro, err)
} }