os: optimize os_windows.v

pull/4229/head
yuyi 2020-04-04 17:59:25 +08:00 committed by GitHub
parent 5313a1401f
commit 0796eb4149
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 6 deletions

View File

@ -293,12 +293,16 @@ pub fn exec(cmd string) ?Result {
}
proc_info := ProcessInformation{}
mut start_info := StartupInfo{}
start_info.cb = sizeof(C.PROCESS_INFORMATION)
start_info.hStdInput = child_stdin
start_info.hStdOutput = child_stdout_write
start_info.hStdError = child_stdout_write
start_info.dwFlags = u32(C.STARTF_USESTDHANDLES)
start_info := StartupInfo{
lpReserved: 0
lpDesktop: 0
lpTitle: 0
cb: sizeof(C.PROCESS_INFORMATION)
hStdInput: child_stdin
hStdOutput: child_stdout_write
hStdError: child_stdout_write
dwFlags: u32(C.STARTF_USESTDHANDLES)
}
command_line := [32768]u16
C.ExpandEnvironmentStringsW(cmd.to_wide(), voidptr(&command_line), 32768)
create_process_ok := C.CreateProcessW(0, command_line, 0, 0, C.TRUE, 0, 0, 0, voidptr(&start_info), voidptr(&proc_info))