StartProcess (open)

Start an OS subprocess

Syntax

LOADLIB "wh::os.whlib";

INTEGER FUNCTION StartProcess(STRING processexecutable, STRING ARRAY arguments, RECORD options)

Parameters

STRING processexecutable

Full path to the process executable to start

STRING ARRAY arguments

An array of arguments to pass to the process (eg, argv[1].. argv[n])

RECORD options

Options

merge_output_errors

TRUE if the error stream should be merged into the output stream (requires take_output=TRUE, ignores take_errors)

separate_processgroup

TRUE if the process should be created in a separate process group

take_errors

TRUE if we want to receive the process output stream (if false, it will be discarded)

take_input

TRUE if we want control of the process input stream (if false, it will be tied to EOF)

take_output

TRUE if we want to receive the process output stream (if false, it will be discarded)

virtualmemorylimit

Virtual memory size - either the size in INTEGER(64) bytes or a string like "200MB", "2GB".

Return value

INTEGER

ID of the process, or 0 if the process could not be launched

Description

Have the OS start a process, under your direct control. Specify what input and output streams you want to process