Note: Textadept 7.2 beta 3 includes this functionality by default. This module is deprecated.


lspawn is a Textadept module for spawning asynchronous processes using GTK. (Therefore, it cannot be used with the ncurses version of Textadept). This is useful for interacting with external programs in a separate thread via stdin, stdout, and stderr. Textadept will not block while external programs are running.



hg repository


Create a ~/.textadept/modules/os/ directory and place the unzipped contents of lspawn_x.x/ there.

On Linux, depending on your architecture (run uname -i to determine it), run:

# x86_64 ONLY
ln -s
# i386 ONLY
ln -s

On Mac OSX, run:

ln -s

In your ~/.textadept/init.lua, load the module:

os.spawn = require 'os.spawn'


Documentation is in spawn.luadoc. You can also load the tags and api adeptsense files in your Lua module's post_init.lua file:

_M.lua.sense.api_files[#_M.lua.sense.api_files + 1] =


Spawn the program program with /tmp/ as the current working directory and prints stdout and stderr to Textadept's message buffer:

os.spawn('/tmp/', 'program', nil, nil, print, print)

Spawn a Lua program that asks for user input:

p = os.spawn(nil, { 'lua', '-e', '' })
p('my input\n') -- do not forget the newline

After spawning a process that does not exit right away, kill it:

p = os.spawn(nil, 'program')

Please see the spawn.luadoc for parameter documentation.

Notes on Win32

There are some hoops to jump through. You need 2 external files:

Both of these files need to go into Textadept's home directory.

The spawned process will create the "black box" console window. There is no way around this. GLib's spawn code uses process.h's _wspawnvp() and _wspawnv() functions, which I think are responsible. I don't think it's possible to swap CreateProcess() for _wspawn*() because GLib uses more low-level functions for pipes and such.

Compiling against Glib

If someone wants to try and use CreateProcess() instead, you'll have to recompile the "gspawn-win32-helper.c" file from Glib source. You can link against Textadept's win32gtk/ glib, but you'll have to jump through more hoops to get some necessary "*.h" files.

Added the file “”.
Deleted the file “”.
Added the file “”.
Deleted the file “”.
Added the file “”.

Edited on Tuesday, April 15th 2014 at 3:33 PM.