Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(53)

Delta Between Two Patch Sets: src/pkg/syscall/exec_windows.go

Issue 4435059: code review 4435059: syscall: correct Windows CreateProcess input parameters (Closed)
Left Patch Set: Created 13 years, 12 months ago
Right Patch Set: diff -r 79deef5a2706 https://go.googlecode.com/hg/ Created 13 years, 12 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/exec/exec_test.go ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Fork, exec, wait, etc. 5 // Fork, exec, wait, etc.
6 6
7 package syscall 7 package syscall
8 8
9 import ( 9 import (
10 "sync" 10 "sync"
11 "unsafe"
11 "utf16" 12 "utf16"
12 ) 13 )
13 14
14 var ForkLock sync.RWMutex 15 var ForkLock sync.RWMutex
15 16
16 // escape rewrites command line argument s as prescribed 17 // escape rewrites command line argument s as prescribed
17 // in http://msdn.microsoft.com/en-us/library/ms880421. 18 // in http://msdn.microsoft.com/en-us/library/ms880421.
18 // This function returns "" (2 double quotes) if s is empty. 19 // This function returns "" (2 double quotes) if s is empty.
19 // Alternatively, these transformations are done: 20 // Alternatively, these transformations are done:
20 // - every back slash (\) is doubled, but only if immediately 21 // - every back slash (\) is doubled, but only if immediately
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 for i := range attr.Files { 273 for i := range attr.Files {
273 if attr.Files[i] > 0 { 274 if attr.Files[i] > 0 {
274 err := DuplicateHandle(p, int32(attr.Files[i]), p, &fd[i ], 0, true, DUPLICATE_SAME_ACCESS) 275 err := DuplicateHandle(p, int32(attr.Files[i]), p, &fd[i ], 0, true, DUPLICATE_SAME_ACCESS)
275 if err != 0 { 276 if err != 0 {
276 return 0, 0, err 277 return 0, 0, err
277 } 278 }
278 defer CloseHandle(int32(fd[i])) 279 defer CloseHandle(int32(fd[i]))
279 } 280 }
280 } 281 }
281 si := new(StartupInfo) 282 si := new(StartupInfo)
282 » GetStartupInfo(si) 283 » si.Cb = uint32(unsafe.Sizeof(*si))
283 si.Flags = STARTF_USESTDHANDLES 284 si.Flags = STARTF_USESTDHANDLES
284 si.StdInput = fd[0] 285 si.StdInput = fd[0]
285 si.StdOutput = fd[1] 286 si.StdOutput = fd[1]
286 si.StdErr = fd[2] 287 si.StdErr = fd[2]
287 288
288 pi := new(ProcessInformation) 289 pi := new(ProcessInformation)
289 290
290 err = CreateProcess(argv0p, argvp, nil, nil, true, CREATE_UNICODE_ENVIRO NMENT, createEnvBlock(attr.Env), dirp, si, pi) 291 err = CreateProcess(argv0p, argvp, nil, nil, true, CREATE_UNICODE_ENVIRO NMENT, createEnvBlock(attr.Env), dirp, si, pi)
291 if err != 0 { 292 if err != 0 {
292 return 0, 0, err 293 return 0, 0, err
293 } 294 }
294 defer CloseHandle(pi.Thread) 295 defer CloseHandle(pi.Thread)
295 296
296 return int(pi.ProcessId), int(pi.Process), 0 297 return int(pi.ProcessId), int(pi.Process), 0
297 } 298 }
298 299
299 func Exec(argv0 string, argv []string, envv []string) (err int) { 300 func Exec(argv0 string, argv []string, envv []string) (err int) {
300 return EWINDOWS 301 return EWINDOWS
301 } 302 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b