-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathshell_win.go
More file actions
41 lines (33 loc) · 757 Bytes
/
Copy pathshell_win.go
File metadata and controls
41 lines (33 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//go:build windows
// +build windows
package zshell
import (
"context"
"errors"
"os/exec"
"syscall"
"github.com/sohaha/zlsgo/zutil"
)
var chcp = zutil.Once(func() struct{} {
_ = exec.Command("chcp", "65001").Run()
return struct{}{}
})
func RunNewProcess(file string, args []string) (pid int, err error) {
return 0, errors.New("windows does not support")
}
func RunBash(ctx context.Context, command string) (code int, outStr, errStr string, err error) {
return ExecCommand(ctx, []string{
"cmd",
"/C",
command,
}, nil, nil, nil)
}
func sysProcAttr(cmd *exec.Cmd) *exec.Cmd {
if cmd.SysProcAttr == nil {
cmd.SysProcAttr = &syscall.SysProcAttr{
// CreationFlags: 0x08000000,
}
}
cmd.SysProcAttr.HideWindow = true
return cmd
}