plasma-umass / browsix

Browsix is a Unix-like operating system for the browser.
Other
3.15k stars 181 forks source link

pty/tty status or integration #74

Closed jerch closed 4 years ago

jerch commented 4 years ago

I have found your project while searching around for existing solutions to get a (lightweight) POSIX like environment abstracted in the browser.

Some background: With xterm.js we often get requests how to run a command/shell locally in the browser (like some own REPL). This is not easy to get done right, since xterm.js is just a terminal emulator that needs to run through a pty/tty to get the typical terminal interface behavior. Thus I started a pty project also to run solely in the browser mimicking parts of that behavior (very early stage: https://github.com/jerch/browser-fakepty). And ofc, since the TTY interface is a core POSIX feature it pulls more and more POSIX concepts into the project.

I kinda approach the "POSIX problem" from the terminal interface (high level behavior to fullfill typical user expectations), and do most things as lightweight JS implementation (a "process" can just be a JS function with all drawbacks of cooperative multitasking, no isolation whatsoever).

I saw that browsix approaches the "problem" from the other side - with syscalls into its own kernel and as a C compile target. While I started to write my own subset of needed syscalls (for file interface) and a stripped down process management (init process as kernel shim) I wonder if browsix would be a better starting point than doing all as handwritten JS shims.

I did not look up your code, whether you already have a TTY interface integrated (sorry for that) - just tested your terminal browser example (which does not seem to expose the more complex TTY/termios features).

So my questions are: