LassoScript Utility
Basics Browse Detail

[OS_Process]

Tag Link [OS_Process] Category OS Process
Type Substitution Source Available Yes
Support Preferred Version 8.5
Change New Data Source Any
Output Type OS_Process Security None
Implementation Sets Lasso 8.5

Description

[OS_Process] allows a native process to be started on the same machine as Lasso Service and for interactive communication with that process to take place. This allows shell scripts to be executed on Mac OS X, Linux, or Windows.

Important - Use of the [OS_Process] data type has several security implications. Any commands issued by this tag are run using the same privileges as Lasso Service. The [OS_Process] tag can be used to access files and other resources without respecting Lasso's built-in security settings. For these reasons the [OS_Process] data type is not installed by default. In order to use this type the OS_Process module must be moved from the Extensions folder to the LassoModules folder (both in the Lasso Professional application folder) and Lasso Service restarted. Use of this type is further restricted to members of the OS Process Users group which is automatically created or to the site administrator.

The [OS_Process] tag accepts three optional parameters which automatically open a native process. These include the path to the executable to call, an array of command line parameters, and an array of environment variables to set. Alternately, these same three parameters can be passed to the [OS_Process->Open] tag.

The executable which is launched will remain open until either the [OS_Process->Close] tag is called, the executable exits, or the [OS_Process] object is destroyed. Many executables will simply return results that can be read using [OS_Process->Read] or [OS_Process->ReadString], but other executables support interactive operation using [OS_Process->Write] to send additional commands or data to the executable and then reading the results. The [OS_Process->Detach] tag can be used to leave some processes running even after the [OS_Process] object has been destroyed.

Syntax

Var: 'myProcess' = (OS_Process: '/bin/ls', (Array: '.'));
Encode_HTML: $myProcess->Read;
$myProcess->Close;

Parameters

Optional Parameters
Executable path The native file path to the executable to call.
Parameters Array An array of command line parameters to pass to the executable.
Environment Variables An array of pairs defining environment variables which should be defined before calling the executable.

Examples

See the Lasso 8 Language Guide for examples of how to use this tag.