1
0
mirror of https://github.com/golang/go synced 2024-09-25 03:10:12 -06: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:
Alex Brainman 2011-04-21 10:36:27 +10:00
parent 98cf39e270
commit 5aad514674
3 changed files with 4 additions and 8 deletions

View File

@ -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])

View File

@ -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) {

View File

@ -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]