This API provides rudimentary process management. It is used mainly by the io
module to provide individual standard input and output to individual programs.
process.load(path:string[, env:table[, init:function[, name:string]]]):coroutine
init
function is specified, that method is called the first time the resulting coroutine is executed, and run before the actual program is started. This allows fine-tuning of the programs environment.name
is specified, that is the name the process will specify in process.running
. It will be nil
otherwise.process.info([level: number]): table
Returns a table containing the command and path of the specified process, and some other data. The level can optionally be provided to get parent processes. It defaults to 1, the current program. 2 is the current program's parent (the one that called process.load
to start the current program) and so on.process.running([level: number]): string, table, string
(deprecated as of 1.5, use process.info instead) Returns the path to the currently running program (i.e. the last process created via process.load
). The level can optionally be provided to get parent processes. It defaults to 1, the current program. 2 is the current program's parent (the one that called process.load
to start the current program) and so on.process.load
. For programs started via the shell this will ususally be the original command. E.g. for ls -l
, the first returned value will be ls
, while this value will be ls -l
.