Commit 0bafe0e5 authored by Alex Brainman's avatar Alex Brainman

syscall: return error instead of panicking in windows StartProcess

Fixes #11417

Change-Id: Iacea829a48b39df0a4f751b06b19e918fbb713d0
Reviewed-on: https://go-review.googlesource.com/11604Reviewed-by: 's avatarRob Pike <r@golang.org>
parent 214c7a2c
......@@ -117,3 +117,12 @@ func TestStatJunctionLink(t *testing.T) {
t.Fatalf("link should point to %v but points to %v instead", expected, got)
}
}
func TestStartProcessAttr(t *testing.T) {
p, err := os.StartProcess(os.Getenv("COMSPEC"), []string{"/c", "cd"}, new(os.ProcAttr))
if err != nil {
return
}
defer p.Wait()
t.Fatalf("StartProcess expected to fail, but succeeded.")
}
......@@ -244,6 +244,9 @@ func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid int, handle
if len(attr.Files) > 3 {
return 0, 0, EWINDOWS
}
if len(attr.Files) < 3 {
return 0, 0, EINVAL
}
if len(attr.Dir) != 0 {
// StartProcess assumes that argv0 is relative to attr.Dir,
......
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