Welcome to the main channel on the development of MoarVM, a virtual machine for NQP and Rakudo (moarvm.org). This channel is being logged for historical purposes.
Set by lizmat on 24 May 2021.
patrickb Hi! I'd like to have support for PTYs in Rakudo (working on a Debugger frontend, and I'd like to hook up the debugged program to a PTY and have the debugger sit on the other end). 19:50
lizmat PTY ? 19:51
patrickb pseudo terminal
The thing you need so that the client process thinks it's STD handles are connected to TTY. 19:52
Should setting up such a thing be implemented in moar land and provide ops / an API to NQP / Rakudo or should there be a nqp::wrap-file-descriptor() that can create a sensible MVMOSHandle given a file descriptor? 19:54
(I fear the former is what's needed, because, how could moar possibly know which operations that handle should support?) 19:55
lizmat do you really need it at that level? or do you just need make Raku think it's a TTY ? 19:56
if the latter, perhaps you could get by by overriding IO::Handle.t ? 19:57
patrickb Fixing up Rakudo to flush set the STD handle buffer size to 0 in that case is a 90 % solution. But with the debugger I want to aim for "epic", so in the end I'd like to have a PTY sitting there. That's the solution that will not break down in edge cases, as the debugged rakudo is really connected to terminal. 19:58
But postponing this topic and turning to an area where progress is easier is certainly an option . :-) 20:00
jnthn patrickb: Nicest would have been if github.com/libuv/libuv/issues/2640 had advanced, but it seems it's not really moved since I looked at it years ago. 20:15
www.npmjs.com/package/node-pty might be something one could use as inspiration or outright port 20:17
patrickb Thanks for the ideas and infos! Quite a bees nest I poked into. 20:55
node-pty uses forkpty, that's a no-go for us. But I think I should be able to adapt this to use my $conn = IO::Socket::INET.new( :host<localhost>, 20:56
:port(3333) );
$conn.print: 'Hello, Raku';
say $conn.recv;
patrickb fail-pasted 20:57
node-pty uses forkpty, that's a no-go for us. But I think I should be able to adapt this to use posix_openpt, ptsname_r and grantpt. 20:58