ICommandLineProcessAsync80

This interface, returned by the ICreator.CreateCommandLineProcessAsync method allows for asynchronous management of command line process operations associated with the launching of TerraExplorer executable tools.

Providing a callback-based mechanism similar to the JavaScript promise and the C# Task, ICommandLineProcessAsync80 supports method chaining, allowing for subsequent method calls directly on the returned object. This ensures a cleaner and more streamlined code structure, and makes asynchronous operations more intuitive to handle.

E.g.,

g_asyncObj = SGWorld.Creator.CreateCommandLineProcessAsync("my.exe param1 param2").OnStdout(function(stdout){

        g_stdout += stdout;

        g_asyncObj.Abort();

    }).Onstderr(function(stderr){

            g_stderr+=stderr;

    }).OnExit(function(exitCode){

        alert(exitCode);

        alert(g_stderr);

        alert(g_stdout);

    });

 

See "Asynchronous Requests" in the "Overview" chapter for C# and JavaScript examples.

 

 

Methods

 

Abort

This method is used to abort or cancel the command line process.

OnExit

This method is called when the command line process exits.

OnStderr

This method is called when the launched command line process encounters an error.

OnStdout

This method is called when the command line process produces output.

Abort

This method is used to abort or cancel the command line process.

 

JavaScript

 

Abort

 

C#

 

void Abort ()

 

C++

 

HRESULT Abort()

OnExit

This method is called when the command line process operation exits. The callback function provided allows handling and processing of the results of the asynchronous operation.

 

JavaScript

 

OnExit (dispFunc)

 

C#

 

ICommandLineProcessAsync80 OnExit (object dispFunc)

 

C++

 

HRESULT OnExit(

       VARIANT dispFunc,

       ICommandLineProcessAsync80** pThis)

 

Parameters

dispFunc

The callback function to be executed when the event occurs. This function receives the exit code of the command line process.

Return Value

pThis

An ICommandLineProcessAsync80, that enables further method chaining or accessing other properties and methods.

Exceptions

See: HRESULT Return Values for a list of possible values returned by the HRESULT.

OnStderr

This method is called when the launched command line process encounters an error. It provides a mechanism to handle errors and exceptions.

 

JavaScript

 

OnStderr (dispFunc)

 

C#

 

ICommandLineProcessAsync80 OnStderr (object dispFunc}

 

C++

 

HRESULT OnStderr (

       VARIANT dispFunc,

       ICommandLineProcessAsync80** pThis)

 

Parameters

dispFunc

The callback function to be executed when the event occurs. This function receives an error message in string format.

Return Value

pThis

An ICommandLineProcessAsync80 that enables further method chaining or accessing other properties and methods.

Exceptions

See: HRESULT Return Values for a list of possible values returned by the HRESULT.

OnStdout

This method is called when the command line process produces output. The callback function provided allows handling and processing of the asynchronous operation results.

 

JavaScript

 

OnStdout (dispFunc)

 

C#

 

ICommandLineProcessAsync80 OnStdout (object dispFunc}

 

C++

 

HRESULT OnStdout (

       VARIANT dispFunc,

       ICommandLineProcessAsync80** pThis)

 

Parameters

dispFunc

The callback function to be executed when the event occurs. This function receives the standard output content from the command line process as a string.

Return Value

pThis

An ICommandLineProcessAsync80, that enables further method chaining or accessing other properties and methods.

Exceptions.

See: HRESULT Return Values for a list of possible values returned by the HRESULT.