lua-users home
lua-l archive

Re: Keep a shell open?

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


On 2018年01月26日 08:16, Russell Haley wrote:
Is it possible to open a shell in a coroutine and just interact with
it when I need it?
So in a coroutine, I would just open it and then read and write then
yield?
As Dirk wrote, `io.popen` is read XOR write.
If you're on some unix-y system & depending on what you're doing,
lpty[1] might work for you.
There may be "simpler"[2] ways to do that, but so far, for me, this was
the "simplest"[3] way to get non-blocking bidirectional communication going.
-- nobody
[1] http://tset.de/lpty/index.html
 (also via `luarocks install lpty`)
[2] as in "not grabbing a PTY yadda yadda"
[3] as in "least amount of thinking/code & sufficiently portable (*nix)"

AltStyle によって変換されたページ (->オリジナル) /