mirror of
https://github.com/golang/go
synced 2024-11-12 07:40:23 -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 + `"`
|
cmd += `"` + v + `"`
|
||||||
}
|
}
|
||||||
argv = []string{"cmd", "/c", "sh", "-c", cmd}
|
argv = []string{"sh", "-c", cmd}
|
||||||
}
|
}
|
||||||
var err os.Error
|
var err os.Error
|
||||||
argv[0], err = exec.LookPath(argv[0])
|
argv[0], err = exec.LookPath(argv[0])
|
||||||
|
@ -9,19 +9,14 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"testing"
|
"testing"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func run(argv []string, stdin, stdout, stderr int) (p *Cmd, err os.Error) {
|
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])
|
exe, err := LookPath(argv[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
p, err = Run(exe, argv, nil, "", stdin, stdout, stderr)
|
return Run(exe, argv, nil, "", stdin, stdout, stderr)
|
||||||
return p, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunCat(t *testing.T) {
|
func TestRunCat(t *testing.T) {
|
||||||
|
@ -8,6 +8,7 @@ package syscall
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
"unsafe"
|
||||||
"utf16"
|
"utf16"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -279,7 +280,7 @@ func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid, handle int,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
si := new(StartupInfo)
|
si := new(StartupInfo)
|
||||||
GetStartupInfo(si)
|
si.Cb = uint32(unsafe.Sizeof(*si))
|
||||||
si.Flags = STARTF_USESTDHANDLES
|
si.Flags = STARTF_USESTDHANDLES
|
||||||
si.StdInput = fd[0]
|
si.StdInput = fd[0]
|
||||||
si.StdOutput = fd[1]
|
si.StdOutput = fd[1]
|
||||||
|
Loading…
Reference in New Issue
Block a user