lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 14 August 2013 08:37, Gunnar Zötl <gz@tset.de> wrote:
> Hi,
>
> this message is to announce the availability of lpty 1.0.1. lpty is a simple
> interface to pty functionality, providing the ability to fork a process and run
> it under pty control. It does not try to mimic the posix API but instead focuses
> on the function of running and controlling a program.
>
> New since version 1.0:
>
> - added getfd method to retrieve the file descriptor of the pty's master side.
>   This has been contributed by Matthew Wild (mwild1 at gmail dot com). His
>   rationale, which I can completely get behind, is this:
>     Having the method name 'getfd' is good, as it makes the pty objects
>     compatible with LuaSocket objects. This means you can pass the pty
>     directly to socket.select()! (it probably works with LuaEvent too,
>     but I haven't tested).
> - changed signal handling to use sigaction() instead of signal()

Last night I took this and made Prosody's mod_auth_external[1], which
delegates user authentication to an external process, completely
non-blocking. I can also confirm now that LuaEvent works fine, it will
accept an fd number directly to base:addevent().

Switching to lpty has also resolved various issues we had with
interaction with some apps and weird stdin/stdout buffering when using
other purely pipe-based libraries with interactive scripts.

Thanks a lot!

Regards,
Matthew

[1]: https://code.google.com/p/prosody-modules/wiki/mod_auth_external