File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -3,13 +3,28 @@ package nginx
33import (
44 "context"
55 "os/exec"
6+ "runtime"
67
78 "github.com/0xJacky/Nginx-UI/internal/docker"
89 "github.com/0xJacky/Nginx-UI/settings"
910)
1011
1112func execShell (cmd string ) (stdOut string , stdErr error ) {
12- return execCommand ("/bin/sh" , "-c" , cmd )
13+ var execCmd * exec.Cmd
14+
15+ if runtime .GOOS == "windows" {
16+ execCmd = exec .Command ("cmd" , "/c" , cmd )
17+ } else {
18+ execCmd = exec .Command ("/bin/sh" , "-c" , cmd )
19+ }
20+
21+ execCmd .Dir = GetNginxExeDir ()
22+ bytes , err := execCmd .CombinedOutput ()
23+ stdOut = string (bytes )
24+ if err != nil {
25+ stdErr = err
26+ }
27+ return
1328}
1429
1530func execCommand (name string , cmd ... string ) (stdOut string , stdErr error ) {
You can’t perform that action at this time.
0 commit comments