added poDemon flag for process management

This commit is contained in:
Araq 2015-10-19 16:08:31 +02:00
commit c977daf9d8
2 changed files with 8 additions and 4 deletions

View file

@ -30,13 +30,14 @@ type
## variable. ## variable.
## On Windows, this is the default. ## On Windows, this is the default.
poEvalCommand, ## Pass `command` directly to the shell, without quoting. poEvalCommand, ## Pass `command` directly to the shell, without quoting.
## Use it only if `command` comes from trused source. ## Use it only if `command` comes from trusted source.
poStdErrToStdOut, ## merge stdout and stderr to the stdout stream poStdErrToStdOut, ## merge stdout and stderr to the stdout stream
poParentStreams, ## use the parent's streams poParentStreams, ## use the parent's streams
poInteractive ## optimize the buffer handling for responsiveness for poInteractive, ## optimize the buffer handling for responsiveness for
## UI applications. Currently this only affects ## UI applications. Currently this only affects
## Windows: Named pipes are used so that you can peek ## Windows: Named pipes are used so that you can peek
## at the process' output streams. ## at the process' output streams.
poDemon ## Windows: The program creates no Window.
ProcessObj = object of RootObj ProcessObj = object of RootObj
when defined(windows): when defined(windows):
@ -523,8 +524,9 @@ when defined(Windows) and not defined(useNimRtl):
var tmp = newWideCString(cmdl) var tmp = newWideCString(cmdl)
var ee = newWideCString(e) var ee = newWideCString(e)
var wwd = newWideCString(wd) var wwd = newWideCString(wd)
success = winlean.createProcessW(nil, var flags = NORMAL_PRIORITY_CLASS or CREATE_UNICODE_ENVIRONMENT
tmp, nil, nil, 1, NORMAL_PRIORITY_CLASS or CREATE_UNICODE_ENVIRONMENT, if poDemon in options: flags = flags or CREATE_NO_WINDOW
success = winlean.createProcessW(nil, tmp, nil, nil, 1, flags,
ee, wwd, si, procInfo) ee, wwd, si, procInfo)
else: else:
success = winlean.createProcessA(nil, success = winlean.createProcessA(nil,

View file

@ -115,6 +115,8 @@ const
SYNCHRONIZE* = 0x00100000'i32 SYNCHRONIZE* = 0x00100000'i32
FILE_FLAG_WRITE_THROUGH* = 0x80000000'i32 FILE_FLAG_WRITE_THROUGH* = 0x80000000'i32
CREATE_NO_WINDOW* = 0x08000000'i32
proc closeHandle*(hObject: Handle): WINBOOL {.stdcall, dynlib: "kernel32", proc closeHandle*(hObject: Handle): WINBOOL {.stdcall, dynlib: "kernel32",
importc: "CloseHandle".} importc: "CloseHandle".}