~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to src/pkg/syscall/exec_windows.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
// getFullPath retrieves the full path of the specified file.
133
133
// Just a wrapper for Windows GetFullPathName api.
134
134
func getFullPath(name string) (path string, err error) {
135
 
        p := StringToUTF16Ptr(name)
 
135
        p, err := UTF16PtrFromString(name)
 
136
        if err != nil {
 
137
                return "", err
 
138
        }
136
139
        buf := make([]uint16, 100)
137
140
        n, err := GetFullPathName(p, uint32(len(buf)), &buf[0], nil)
138
141
        if err != nil {
225
228
}
226
229
 
227
230
type SysProcAttr struct {
228
 
        HideWindow bool
229
 
        CmdLine    string // used if non-empty, else the windows command line is built by escaping the arguments passed to StartProcess
 
231
        HideWindow    bool
 
232
        CmdLine       string // used if non-empty, else the windows command line is built by escaping the arguments passed to StartProcess
 
233
        CreationFlags uint32
230
234
}
231
235
 
232
236
var zeroProcAttr ProcAttr
261
265
                        return 0, 0, err
262
266
                }
263
267
        }
264
 
        argv0p := StringToUTF16Ptr(argv0)
 
268
        argv0p, err := UTF16PtrFromString(argv0)
 
269
        if err != nil {
 
270
                return 0, 0, err
 
271
        }
265
272
 
266
273
        var cmdline string
267
274
        // Windows CreateProcess takes the command line as a single string:
275
282
 
276
283
        var argvp *uint16
277
284
        if len(cmdline) != 0 {
278
 
                argvp = StringToUTF16Ptr(cmdline)
 
285
                argvp, err = UTF16PtrFromString(cmdline)
 
286
                if err != nil {
 
287
                        return 0, 0, err
 
288
                }
279
289
        }
280
290
 
281
291
        var dirp *uint16
282
292
        if len(attr.Dir) != 0 {
283
 
                dirp = StringToUTF16Ptr(attr.Dir)
 
293
                dirp, err = UTF16PtrFromString(attr.Dir)
 
294
                if err != nil {
 
295
                        return 0, 0, err
 
296
                }
284
297
        }
285
298
 
286
299
        // Acquire the fork lock so that no other threads
313
326
 
314
327
        pi := new(ProcessInformation)
315
328
 
316
 
        err = CreateProcess(argv0p, argvp, nil, nil, true, CREATE_UNICODE_ENVIRONMENT, createEnvBlock(attr.Env), dirp, si, pi)
 
329
        flags := sys.CreationFlags | CREATE_UNICODE_ENVIRONMENT
 
330
        err = CreateProcess(argv0p, argvp, nil, nil, true, flags, createEnvBlock(attr.Env), dirp, si, pi)
317
331
        if err != nil {
318
332
                return 0, 0, err
319
333
        }