I completely understand your point of view Saghul, my reason for proposing
this as last-minute feature of 0.12 is because I believe that at least for
the supported unixes, the necessary changes will be very small.
For example, here's a relevant snippet of code from the st terminal emulator
void
ttynew(void) {
int m, s;
struct winsize w = {term.row, term.col, 0, 0};
/* seems to work fine on linux, openbsd and freebsd */
if(openpty(&m, &s, NULL, NULL, &w) < 0)
die("openpty failed: %s\n", SERRNO);
switch(pid = fork()) {
As you can see, this is very similar to the pipe/fork combination already
used by UNIX implementation of uv_spawn. The only difference is the
`openpty` call, which also returns a pair of file descriptors to be wrapped
into libuv's uv_pipe_t/uv_tty_t abstractions.
Other than that, I think two problems remain:
- Create compatibility layer for solaris, which may not have the the
`openpty` system call(which is an abstraction to the OS-specific terminal
API)
- Figure out how that fits into windows, which may use completely different
method for communicating with terminal programs
If you guys think there's a chance of this happening before 0.12, it will
be enough motivation for me to give it a shot, even if it's not ultimately
merged.
On Friday, July 25, 2014 7:58:14 AM UTC-3, Saúl Ibarra Corretgé wrote:
>
> Hi Thiago,
>
> On 07/25/2014 11:59 AM, Thiago Arruda wrote:
> > The ability to automate interactive programs using libuv would be a
> > killer feature, libuv could be used as a replacement for libexpect and
> > node.js a replacement for expect :)
> >
> > I imagine that beyond the system calls used to open the pty, there's not
> > much difference between ptys and pipes from the programmer POV(at least
> > on UNIX). If I managed to implement a UV_CREATE_TERMINAL spawn option by
> > the end of next week, is there any chance it would make into 0.12? I'm
> > particularly interested in this, since it's a feature Neovim could
> > benefit from.
> >
> > The patch would include:
> >
> > - The UV_CREATE_TERMINAL option, which would use the `pty()` instead of
> > `pipe()` on UNIX
> > - A windows implementation(I would need to study winpty source code and
> > adapt the solution to libuv)
> > - A good set of tests
> >
>
> This would indeed be a very welcome addition. Unfortunately I'm not sure
> about adding it to 0.12, not because you can't make it happen before we
> release it (you probably will) but the line needs to be drawn somewhere,
> otherwise there will always be "one more patch" and we'll never ship it.
>
> I'm open to being convinced otherwise, though. Fedor?
>
> --
> Saúl Ibarra Corretgé
> bettercallsaghul.com
>
>
>
--
You received this message because you are subscribed to the Google Groups
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.