mirror of
https://github.com/golang/go
synced 2024-11-25 02:07:58 -07:00
syscall: correct Windows CreateProcess input parameters
Fixes #1718. R=golang-dev, rsc, peterGo, r CC=golang-dev https://golang.org/cl/4435059
This commit is contained in:
parent
98cf39e270
commit
5aad514674
@ -285,7 +285,7 @@ func doRun(argv []string, returnStdout bool) string {
|
||||
}
|
||||
cmd += `"` + v + `"`
|
||||
}
|
||||
argv = []string{"cmd", "/c", "sh", "-c", cmd}
|
||||
argv = []string{"sh", "-c", cmd}
|
||||
}
|
||||
var err os.Error
|
||||
argv[0], err = exec.LookPath(argv[0])
|
||||
|
@ -9,19 +9,14 @@ import (
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
"os"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
func run(argv []string, stdin, stdout, stderr int) (p *Cmd, err os.Error) {
|
||||
if runtime.GOOS == "windows" {
|
||||
argv = append([]string{"cmd", "/c"}, argv...)
|
||||
}
|
||||
exe, err := LookPath(argv[0])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p, err = Run(exe, argv, nil, "", stdin, stdout, stderr)
|
||||
return p, err
|
||||
return Run(exe, argv, nil, "", stdin, stdout, stderr)
|
||||
}
|
||||
|
||||
func TestRunCat(t *testing.T) {
|
||||
|
@ -8,6 +8,7 @@ package syscall
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"unsafe"
|
||||
"utf16"
|
||||
)
|
||||
|
||||
@ -279,7 +280,7 @@ func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid, handle int,
|
||||
}
|
||||
}
|
||||
si := new(StartupInfo)
|
||||
GetStartupInfo(si)
|
||||
si.Cb = uint32(unsafe.Sizeof(*si))
|
||||
si.Flags = STARTF_USESTDHANDLES
|
||||
si.StdInput = fd[0]
|
||||
si.StdOutput = fd[1]
|
||||
|
Loading…
Reference in New Issue
Block a user