Looking for Library to create and control a psuedo-tty

Is there a ocaml library to create a process in a psuedo-tty and read/send characters to it (something like GitHub - microsoft/node-pty: Fork pseudoterminals in Node.JS for node as an example?).

This seems to be a common enough need so I’m sure something like this is somewhere in the ocaml ecosystem though I have not found useful something yet.

I could always build stuff from scratch using low level functions but I’m wondering if something is already available. I would prefer it uses Lwt.

Long long long ago I wrote one. I am quite sure I announced it on the mailing list, but I don’t remember where I put it, this was way before git let alone GitHub. Look for something like mlexpect, maybe it’s in the list archive if it goes back far enough, or maybe the way back machine knows. :smirk:

I hacked together a library just for this: mprocs/pty at master · pvolok/mprocs · GitHub. It also works on windows (with conpty support). It’s not a reusable library but can be used as a working example.

1 Like

Thanks for your helpful reply – I notice that currently there is no license in the repository. If you could add one, it would be much appreciated!

I would just add MIT. But I vendor some libraries and not sure if I need to add any notes. Is anything preventing you from copy-pasting the code?

I wont be able to copy paste or reuse any code unless there is some sort of an open source license. I’m assuming that this is your own code and you own the copyright to it – in that case you can add the relevant license to the project and/or source files.

Vendored stuff, as far as my own understanding goes (I am not a lawyer), always maintains its original license and copyright.

Of course, there is no hurry to do any of this. If you’re not ready to add your license to your project just yet that’s totally cool. Thanks for your helpful response!