Yes it seems that could work, though a cross-platform API would be way 
nicer :)

I will start looking into this tomorrow, and will open a PR until next 
sunday if the implementation is sufficiently simple to be merged before 
0.12.

Thanks for the opportunity.

On Friday, July 25, 2014 8:53:51 AM UTC-3, Saúl Ibarra Corretgé wrote:
>
> On 07/25/2014 01:44 PM, Thiago Arruda wrote: 
> > 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. 
> > 
>
> You are more than welcome to give it a try and see how deep the 
> rabbit-hole goes :-) 
>
> Now, assuming we merge this after 0.12, wouldn't the following work with 
> current master? (at least on Unixes): 
>
> * call openpty yourself 
> * create a pipe or tty handle with the given fd (uv_pipe_init + 
> uv_pipe_open / uv_tty_init) 
> * use UV_INHERIT_STREAM when calling uv_spawn 
> * profit? 
>
>
> -- 
> 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.

Reply via email to