1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

os: add create_no_window parameter to Process (#17726)

This commit is contained in:
d3c0d3d.exe 2023-03-21 06:24:40 -03:00 committed by GitHub
parent e1d4539a14
commit 54a1b66b94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 9 deletions

View File

@ -33,6 +33,7 @@ pub mut:
use_pgroup bool // when true, the process will create a new process group, enabling .signal_pgkill() use_pgroup bool // when true, the process will create a new process group, enabling .signal_pgkill()
stdio_fd [3]int // the stdio file descriptors for the child process, used only by the nix implementation stdio_fd [3]int // the stdio file descriptors for the child process, used only by the nix implementation
wdata voidptr // the WProcess; used only by the windows implementation wdata voidptr // the WProcess; used only by the windows implementation
create_no_window bool // sets a value indicating whether to start the process in a new window, The default is false; used only by the windows implementation
} }
// new_process - create a new process descriptor // new_process - create a new process descriptor

View File

@ -97,7 +97,11 @@ fn (mut p Process) win_spawn_process() int {
cmd := '${p.filename} ' + p.args.join(' ') cmd := '${p.filename} ' + p.args.join(' ')
C.ExpandEnvironmentStringsW(cmd.to_wide(), voidptr(&wdata.command_line[0]), 32768) C.ExpandEnvironmentStringsW(cmd.to_wide(), voidptr(&wdata.command_line[0]), 32768)
mut creation_flags := int(C.NORMAL_PRIORITY_CLASS) mut creation_flags := if p.create_no_window {
int(C.CREATE_NO_WINDOW)
} else {
int(C.NORMAL_PRIORITY_CLASS)
}
if p.use_pgroup { if p.use_pgroup {
creation_flags |= C.CREATE_NEW_PROCESS_GROUP creation_flags |= C.CREATE_NEW_PROCESS_GROUP
} }