Open Search
    SystemProcessInterface Class Reference

    #include <system_process.h>

    Detailed Description

    This interface allows to access and create system processes.

    Static Public Member Functions

    static MAXON_METHOD Result< SystemProcessObjectRef > CreateProcess (const Url &programPath, const ArrayInterface< String > &arguments, EXECUTEPROGRAMFLAGS flags, void *userData, const InOutputStreamRef &stdinPipe=InOutputStreamRef(), const InOutputStreamRef &stdoutPipe=InOutputStreamRef(), const InOutputStreamRef &stderrPipe=InOutputStreamRef())
     
    static MAXON_METHOD Result< SystemProcessObjectRef > StartProcessAndWait (const Url &programPath, const ArrayInterface< String > &arguments, EXECUTEPROGRAMFLAGS flags, ExecuteProgramCallback callback, void *userData)
     
    static MAXON_METHOD Result< void > GetSystemProcesses (const ValueReceiver< const SystemProcessObjectRef & > &processes)
     
    static MAXON_METHOD UInt GetCurrentProcessId ()
     
    static MAXON_METHOD Result< SystemProcessObjectRef > GetProcess (UInt id)
     
    static MAXON_METHOD Result< WAIT_PROCESS_RESULTWaitForProcess (const SystemProcessObjectRef &processRef, const TimeValue &timeout)
     

    Private Member Functions

     MAXON_INTERFACE_NONVIRTUAL (SystemProcessInterface, MAXON_REFERENCE_STATIC, "net.maxon.interface.systemprocess")
     

    Member Function Documentation

    ◆ MAXON_INTERFACE_NONVIRTUAL()

    MAXON_INTERFACE_NONVIRTUAL ( SystemProcessInterface  ,
    MAXON_REFERENCE_STATIC  ,
    "net.maxon.interface.systemprocess"   
    )
    private

    ◆ CreateProcess()

    static MAXON_METHOD Result<SystemProcessObjectRef> CreateProcess ( const Url programPath,
    const ArrayInterface< String > &  arguments,
    EXECUTEPROGRAMFLAGS  flags,
    void *  userData,
    const InOutputStreamRef &  stdinPipe = InOutputStreamRef(),
    const InOutputStreamRef &  stdoutPipe = InOutputStreamRef(),
    const InOutputStreamRef &  stderrPipe = InOutputStreamRef() 
    )
    static

    Prepares an executable to be executed as a process. If EXECUTEPROGRAMFLAGS::CAPTURELOGFILE is set all pipe parameters will be ignored.

    Parameters
    [in]programPathFile path to the executable. It needs to be a valid path to a URLSCHEME_FILESYSTEM path. If an stdout and stderr pipe is used CAPTURELOGFILE will be ignored.
    [in]argumentsArray of parameters to start the executable with.
    [in]flagsSee EXECUTEPROGRAMFLAGS flags.
    [in]userDataUser data that can be attached to this process.
    [in]stdinPipePipe where stdin is redirected to.
    [in]stdoutPipePipe where stdout is redirected to.
    [in]stderrPipePipe where stderr is redirected to.
    Returns
    Reference object to a system process.

    ◆ StartProcessAndWait()

    static MAXON_METHOD Result<SystemProcessObjectRef> StartProcessAndWait ( const Url programPath,
    const ArrayInterface< String > &  arguments,
    EXECUTEPROGRAMFLAGS  flags,
    ExecuteProgramCallback  callback,
    void *  userData 
    )
    static

    Starts and waits for a process.

    Parameters
    [in]programPathFile path to the executable. It needs to be a valid path to a URLSCHEME_FILESYSTEM path.
    [in]argumentsArray of parameters to start the executable with.
    [in]flagsSee EXECUTEPROGRAMFLAGS flags.
    [in]callbackPointer to a Callback function called while the executable is running. See ExecuteProgramCallback.
    [in]userDataUser data that can be attached to this process.
    Returns
    Reference object to a system process. Please note that the process is already done. You can use this handle to determine the log file or the exit code.

    ◆ GetSystemProcesses()

    static MAXON_METHOD Result<void> GetSystemProcesses ( const ValueReceiver< const SystemProcessObjectRef & > &  processes)
    static

    Enumerates all system processes and returns a list of them.

    Parameters
    [out]processesThe receiver for the system processes.
    Returns
    OK on success.

    ◆ GetCurrentProcessId()

    static MAXON_METHOD UInt GetCurrentProcessId ( )
    static

    Gets the process ID of the current running process.

    Returns
    The current process ID.

    ◆ GetProcess()

    static MAXON_METHOD Result<SystemProcessObjectRef> GetProcess ( UInt  id)
    static

    Creates a process object for the given process ID. The returned object will have only limited capabilities. E.g. you cannot get the logfile or user data.

    Parameters
    [in]idID of the process you want to create an object for.
    Returns
    Reference object to a system process.

    ◆ WaitForProcess()

    static MAXON_METHOD Result<WAIT_PROCESS_RESULT> WaitForProcess ( const SystemProcessObjectRef &  processRef,
    const TimeValue timeout 
    )
    static

    Waits for the given process to finish.

    Parameters
    [in]processRefProcess object to wait for.
    [in]timeoutTimeout to wait for the process to finish.
    Returns
    Returns whether the process is still running or not.