Commit f3df9d65 authored by Michael Snoyman's avatar Michael Snoyman
Browse files

Support for CREATE_NEW_CONSOLE (fixes #38)

parent 48b9e770
......@@ -125,6 +125,7 @@ proc cmd args = CreateProcess { cmdspec = RawCommand cmd args,
create_group = False,
delegate_ctlc = False,
detach_console = False,
create_new_console = False,
new_session = False }
-- | Construct a 'CreateProcess' record for passing to 'createProcess',
......@@ -140,6 +141,7 @@ shell str = CreateProcess { cmdspec = ShellCommand str,
create_group = False,
delegate_ctlc = False,
detach_console = False,
create_new_console = False,
new_session = False }
{- |
......
......@@ -185,6 +185,11 @@ data CreateProcess = CreateProcess{
detach_console :: Bool, -- ^ Use the windows DETACHED_PROCESS flag when creating the process; does nothing on other platforms.
--
-- /Since: 1.3.0.0/
create_new_console :: Bool, -- ^ Use the windows CREATE_NEW_CONSOLE flag when creating the process; does nothing on other platforms.
--
-- Default: @False@
--
-- /Since: 1.3.0.0/
new_session :: Bool -- ^ Use posix setsid to start the new process in a new session; does nothing on other platforms.
--
-- /Since: 1.3.0.0/
......@@ -267,6 +272,7 @@ createProcess_ fun CreateProcess{ cmdspec = cmdsp,
create_group = mb_create_group,
delegate_ctlc = mb_delegate_ctlc,
detach_console = mb_detach_console,
create_new_console = mb_create_new_console,
new_session = mb_new_session }
= do
let (cmd,args) = commandToProcess cmdsp
......@@ -299,6 +305,7 @@ createProcess_ fun CreateProcess{ cmdspec = cmdsp,
((if mb_close_fds then RUN_PROCESS_IN_CLOSE_FDS else 0)
.|.(if mb_create_group then RUN_PROCESS_IN_NEW_GROUP else 0)
.|.(if mb_detach_console then RUN_PROCESS_DETACHED else 0)
.|.(if mb_create_new_console then RUN_PROCESS_NEW_CONSOLE else 0)
.|.(if mb_new_session then RUN_PROCESS_NEW_SESSION else 0))
pFailedDoing
......@@ -432,6 +439,7 @@ createProcess_ fun CreateProcess{ cmdspec = cmdsp,
create_group = mb_create_group,
delegate_ctlc = _ignored,
detach_console = mb_detach_console,
create_new_console = mb_create_new_console,
new_session = mb_new_session }
= do
(cmd, cmdline) <- commandToProcess cmdsp
......@@ -465,6 +473,7 @@ createProcess_ fun CreateProcess{ cmdspec = cmdsp,
((if mb_close_fds then RUN_PROCESS_IN_CLOSE_FDS else 0)
.|.(if mb_create_group then RUN_PROCESS_IN_NEW_GROUP else 0)
.|.(if mb_detach_console then RUN_PROCESS_DETACHED else 0))
.|.(if mb_create_new_console then RUN_PROCESS_NEW_CONSOLE else 0))
.|.(if mb_new_session then RUN_PROCESS_NEW_SESSION else 0))
hndStdInput <- mbPipe mb_stdin pfdStdInput WriteMode
......
......@@ -571,6 +571,9 @@ runInteractiveProcess (wchar_t *cmd, wchar_t *workingDirectory,
if ((flags & RUN_PROCESS_DETACHED) != 0) {
dwFlags |= DETACHED_PROCESS;
}
if ((flags & RUN_PROCESS_NEW_CONSOLE) != 0) {
dwFlags |= CREATE_NEW_CONSOLE;
}
if (!CreateProcess(NULL, cmd, NULL, NULL, inherit, dwFlags, environment, workingDirectory, &sInfo, &pInfo))
{
......
......@@ -4,6 +4,7 @@
* Add StdStream(NoStream) to have standard handles closed. [#13](https://github.com/haskell/process/pull/13)
* Support for Windows `DETACHED_PROCESS` and `setsid` [#32](https://github.com/haskell/process/issues/32)
* Support for Windows `CREATE_NEW_CONSOLE` [#38](https://github.com/haskell/process/issues/38)
## 1.2.3.0 *March 2015*
......
......@@ -8,3 +8,4 @@
#define RUN_PROCESS_IN_NEW_GROUP 0x2
#define RUN_PROCESS_DETACHED 0x4
#define RUN_PROCESS_NEW_SESSION 0x8
#define RUN_PROCESS_NEW_CONSOLE 0x16
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment