lua-users home
lua-l archive

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


Gunnar Zötl wrote:
you may have noticed that the purpose of lpty is very different from that of luasocket. I have written lpty with a single purpose in mind: to be able to control other command line programs. Pls keep that in mind with my following comments to your suggestions.
IMHO it is better, if communication with another program via socket and communication with another program via pty will be similar.

4. You define sendok() and readok(), but sometimes better is check
several file descriptors in one select/poll call.
luasocket provide getfd() function for this.

This is a bit out of scope for this lib. As I mentioned, this is about controlling programs from lua. I might think about such a thing, should the need arise to control hordes of programs simultaneously from one script, but currently I don't see it.

for example one Lua script can work with socket and pty simultaneously.
adding getfd() call need only few lines of code ;)


Allow me to pull in the suggestion you made in another mail:
> I need to run pppd over pty from Lua script.
> pppd do not need stin/stdout redirection (pty name must be specified
> in parameters).
> I think this code must be optional:
> dup2(ttyfd, 0);
> dup2(ttyfd, 1);
> dup2(ttyfd, 2);

Again, out of scope. But I also think that it would not hurt your application, you can still pass the ttyname to your pppd, as long as it does not also write to stdout. Also, if it is not passed a tty name, pppd will use stdin/stdout, at least that's what the manual says. So you should be safe there.
hmm... pppd can write something to stderr