io.launcher: add the hidden slot to the process tuple

Implemented on Windows only.
char-rename
Alexander Iljin 2016-06-21 23:34:44 +03:00 committed by John Benediktsson
parent 73c153fa21
commit 85710ced87
3 changed files with 20 additions and 9 deletions

View File

@ -11,6 +11,9 @@ ARTICLE: "io.launcher.detached" "Running processes in the background"
"By default, " { $link run-process } " waits for the process to complete. To run a process without waiting for it to finish, set the " { $snippet "detached" } " slot of a " { $link process } ", or use the following word:" "By default, " { $link run-process } " waits for the process to complete. To run a process without waiting for it to finish, set the " { $snippet "detached" } " slot of a " { $link process } ", or use the following word:"
{ $subsections run-detached } ; { $subsections run-detached } ;
ARTICLE: "io.launcher.hidden" "Running hidden processes"
"By default, child processes can create and display their own (console and other) windows. To signal to a process that it should stay hidden, set the " { $snippet "hidden" } " slot of the " { $link process } " before running it. The processes are free to ignore this signal." ;
ARTICLE: "io.launcher.environment" "Setting environment variables" ARTICLE: "io.launcher.environment" "Setting environment variables"
"The " { $snippet "environment" } " slot of a " { $link process } " contains an association mapping environment variable names to values. The interpretation of environment variables is operating system-specific." "The " { $snippet "environment" } " slot of a " { $link process } " contains an association mapping environment variable names to values. The interpretation of environment variables is operating system-specific."
$nl $nl
@ -338,6 +341,7 @@ ARTICLE: "io.launcher" "Operating system processes"
"io.launcher.lifecycle" "io.launcher.lifecycle"
"io.launcher.command" "io.launcher.command"
"io.launcher.detached" "io.launcher.detached"
"io.launcher.hidden"
"io.launcher.environment" "io.launcher.environment"
"io.launcher.redirection" "io.launcher.redirection"
"io.launcher.priority" "io.launcher.priority"

View File

@ -13,6 +13,7 @@ TUPLE: process < identity-tuple
command command
detached detached
hidden
environment environment
environment-mode environment-mode

View File

@ -1,15 +1,15 @@
! Copyright (C) 2007, 2010 Doug Coleman, Slava Pestov. ! Copyright (C) 2007, 2010 Doug Coleman, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien alien.c-types alien.data arrays assocs USING: accessors alien alien.c-types alien.data arrays assocs
classes classes.struct combinators concurrency.flags classes classes.struct combinators combinators.short-circuit
continuations debugger destructors init io io.backend concurrency.flags continuations debugger destructors init io
io.backend.windows io.files io.files.private io.files.windows io.backend io.backend.windows io.files io.files.private
io.launcher io.launcher.private io.pathnames io.pipes io.files.windows io.launcher io.launcher.private io.pathnames
io.pipes.windows io.ports kernel libc locals make math io.pipes io.pipes.windows io.ports kernel libc literals locals
namespaces prettyprint sequences specialized-arrays splitting make math namespaces prettyprint sequences specialized-arrays
splitting.monotonic strings system threads windows splitting splitting.monotonic strings system threads windows
windows.errors windows.handles windows.kernel32 windows.types windows.errors windows.handles windows.kernel32 windows.types
combinators.short-circuit ; windows.user32 ;
SPECIALIZED-ARRAY: ushort SPECIALIZED-ARRAY: ushort
SPECIALIZED-ARRAY: void* SPECIALIZED-ARRAY: void*
IN: io.launcher.windows IN: io.launcher.windows
@ -123,7 +123,13 @@ TUPLE: CreateProcess-args
] when ; ] when ;
: fill-startup-info ( process args -- process args ) : fill-startup-info ( process args -- process args )
dup lpStartupInfo>> STARTF_USESTDHANDLES >>dwFlags drop ; over hidden>> [ dup lpStartupInfo>> ] dip
[
flags{ STARTF_USESTDHANDLES STARTF_USESHOWWINDOW } >>dwFlags
SW_HIDE >>wShowWindow
] [
STARTF_USESTDHANDLES >>dwFlags
] if drop ;
: make-CreateProcess-args ( process -- args ) : make-CreateProcess-args ( process -- args )
default-CreateProcess-args default-CreateProcess-args