simSubprocess Plugin API reference

API functions for subprocess

simSubprocess.exec
simSubprocess.execAsync
simSubprocess.getpid
simSubprocess.isRunning
simSubprocess.kill
simSubprocess.wait

simSubprocess.exec

Description Execute a subprocess.
Lua synopsis int exitCode, buffer output = simSubprocess.exec(string programPath, string[] args, buffer input="", exec_opts opts={})
Lua parameters
programPath (string): Program path.
args (table of string): Program arguments.
input (buffer, default: ""): Data passed to stdin.
opts (exec_opts, default: {}): Options. see exec_opts
Lua return values
exitCode (int)
output (buffer)
Python synopsis int exitCode, buffer output = simSubprocess.exec(string programPath, list args, buffer input="", exec_opts opts={})

simSubprocess.execAsync

Description Execute a subprocess without waiting for termination.
Lua synopsis string handle = simSubprocess.execAsync(string programPath, string[] args, exec_opts opts={})
Lua parameters
programPath (string): Program path.
args (table of string): Program arguments.
opts (exec_opts, default: {}): Options. see exec_opts
Lua return values
handle (string)
Python synopsis string handle = simSubprocess.execAsync(string programPath, list args, exec_opts opts={})

simSubprocess.getpid

Description Get the process identifier (OS-dependent).
Lua synopsis long pid = simSubprocess.getpid(string handle)
Lua parameters
handle (string)
Lua return values
pid (long)
Python synopsis long pid = simSubprocess.getpid(string handle)

simSubprocess.isRunning

Description Check wether a subprocess previously launched with simSubprocess.execAsync is running.
Lua synopsis bool running = simSubprocess.isRunning(string handle)
Lua parameters
handle (string)
Lua return values
running (bool)
Python synopsis bool running = simSubprocess.isRunning(string handle)

simSubprocess.kill

Description Forcefully terminate a subprocess previously launched with simSubprocess.execAsync.
Lua synopsis int exitCode = simSubprocess.kill(string handle)
Lua parameters
handle (string)
Lua return values
exitCode (int)
Python synopsis int exitCode = simSubprocess.kill(string handle)

simSubprocess.wait

Description Wait for termination of a subprocess previously launched with simSubprocess.execAsync. If subprocess terminates, the exit code is returned.
Lua synopsis int exitCode = simSubprocess.wait(string handle, float timeout=5)
Lua parameters
handle (string)
timeout (float, default: 5)
Lua return values
exitCode (int)
Python synopsis int exitCode = simSubprocess.wait(string handle, float timeout=5)



Data structures

Data structures are used to pass complex data around. Create data structures in Lua in the form of a map, e.g.: {line_size=3, add_to_legend=false, selectable=true}

exec_opts

Description
Fields
useSearchPath (bool, default: true): Resolve program name searching in PATH entries.
openNewConsole (bool, default: false): Win32-specific flag.
workingDir (string): Start process in a specific working directory.
See also