Commit 5aad5146 authored by Alex Brainman's avatar Alex Brainman

syscall: correct Windows CreateProcess input parameters

Fixes #1718.

R=golang-dev, rsc, peterGo, r
CC=golang-dev
https://golang.org/cl/4435059
parent 98cf39e2
...@@ -285,7 +285,7 @@ func doRun(argv []string, returnStdout bool) string { ...@@ -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 ( ...@@ -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 ...@@ -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, ...@@ -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]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment