Skip to content

daurnimator/lua-spawn

Folders and files

NameName
Last commit message
Last commit date
Aug 14, 2018
Mar 7, 2019
Mar 10, 2017
Jul 17, 2018
Sep 15, 2015
Apr 6, 2016
Mar 14, 2017
Jun 1, 2018
Aug 10, 2018
Aug 14, 2018
Jun 1, 2018

Repository files navigation

A lua library to spawn programs

Status

Build Status

Features

  • High level functions for common cases
  • Bindings to the full posix_spawn family of functions
  • Compatible with Lua 5.1, 5.2, 5.3 and LuaJIT

Currently only works on POSIXy systems, but the high level module should be portable to Windows; someone just needs to put the work in.

Installation

It's recommended to install lua-spawn by using luarocks. This will automatically install run-time lua dependencies for you.

$ luarocks install spawn

Rationale

Spawning a new child program from a lua script is surprisingly hard.

Existing solutions:

  • os.execute doesn't allow interaction with any file descriptors
  • io.popen only allows interaction with one of stdin or stdout
  • fork + exec isn't portable to non-MMU or non-unix architectures

This project uses the posix_spawn family of functions.