summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-10-19 16:08:31 +0200
committerAraq <rumpf_a@web.de>2015-10-19 16:09:34 +0200
commitc977daf9d88f02a1bf9763bbc1efcece9f168603 (patch)
tree20d9b29724122255a53cc02ffb4fb30a8d9effc4
parent1f3e473529600f8c4b3118e6b7c6ce566fd71579 (diff)
downloadNim-c977daf9d88f02a1bf9763bbc1efcece9f168603.tar.gz
added poDemon flag for process management
-rw-r--r--lib/pure/osproc.nim10
-rw-r--r--lib/windows/winlean.nim2
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim
index fa20afff0..9929abb95 100644
--- a/lib/pure/osproc.nim
+++ b/lib/pure/osproc.nim
@@ -30,13 +30,14 @@ type
                          ## variable.
                          ## On Windows, this is the default.
     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
     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
                          ## Windows: Named pipes are used so that you can peek
                          ## at the process' output streams.
+    poDemon              ## Windows: The program creates no Window.
 
   ProcessObj = object of RootObj
     when defined(windows):
@@ -523,8 +524,9 @@ when defined(Windows) and not defined(useNimRtl):
       var tmp = newWideCString(cmdl)
       var ee = newWideCString(e)
       var wwd = newWideCString(wd)
-      success = winlean.createProcessW(nil,
-        tmp, nil, nil, 1, NORMAL_PRIORITY_CLASS or CREATE_UNICODE_ENVIRONMENT,
+      var flags = 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)
     else:
       success = winlean.createProcessA(nil,
diff --git a/lib/windows/winlean.nim b/lib/windows/winlean.nim
index 89d86c62a..4962186fb 100644
--- a/lib/windows/winlean.nim
+++ b/lib/windows/winlean.nim
@@ -115,6 +115,8 @@ const
   SYNCHRONIZE* = 0x00100000'i32
   FILE_FLAG_WRITE_THROUGH* = 0x80000000'i32
 
+  CREATE_NO_WINDOW* = 0x08000000'i32
+
 proc closeHandle*(hObject: Handle): WINBOOL {.stdcall, dynlib: "kernel32",
     importc: "CloseHandle".}