Lite XL

DE

English Deutsch

Über

FAQ Funktionen Screenshots Mitwirkende

Dokumentation

Nutzen Bauen Standard Keymap MacOS Keymap

Tutorials

Einfaches Plugin Syntaxhervorhebung API Overview Systemschriftarten

Plugins

Downloads

Suchen

Process API

Lite XL provides a process API to launch external applications. This API is meant to replace lua's io.popen and lite's pipe-to-a-file approach.

Advantages of this API includes:

Using the Process API

Error handling

Starting a process

To start a process, use process.start(args, options).

Here are some of the more useful arguments.

for options.std{in,out,err}, valid values are:

Reading from process

To read from stdout or stderr of a process, use process:read_stdout() and process:read_stderr() respectively.

You can specify a numeric argument to them, which will change the size of internal buffer used to read the output.

Alternatively, you could use process:read() with process.STREAM_STDERR and process.STREAM_STDOUT.

Example:

local proc = process.start { "sh", "-c", "echo hello world!" }

-- do not use `while proc:running()` if you care about output.
-- The process could die and leave data in the buffer
-- You should just read until `proc:read_stdout()` returns nil
while true do
  local rdbuf = proc:read_stdout()
  if not rdbuf then break end
  -- yay, output
end

Writing to process

You can use process:write(data) to write a string to stdin.

Checking completion

Terminating process

Misc

Mache mit

Github Discord Matrix

Status