browsix icon indicating copy to clipboard operation
browsix copied to clipboard

[Semi-WIP] Rewrite terminal based on xterm.js; redirecting stdin, using dash

Open ids1024 opened this issue 5 years ago • 1 comments

https://github.com/plasma-umass/browsix/issues/16

This code works, but there are a couple awkward details.

browsix-xtermjs

Advantages over previous implementation

  • Runs an actual shell, dash, providing working directories, variables, and all other standard POSIX shell features
  • Supports input redirection. For instance, it is possible to call cat and see it redirect stdin to stdout (but not to close it, since ctrl-c and ctrl-d are not implemented)
  • xterm.js supports a large range of console features, such as color, which I tested; and probably too many other things for me to be able to name.

Disadvantages from previous implementation

  • Annoyingly, no prompt is displayed. Dash only displays a prompt when connected to a tty

Other notes

I made some awkward changes in gulpfile.js to copy the xterm.js library from npm, since it doesn't support bower. I think the bobby/modern-build branch is getting rid of bower? In which case, I (or someone else) can update this once that code is merged.

A fully functional terminal will require some form of pty implementation. There seems to be some initial code for that in the _term3 branch, but that appears to have never been finished.

The line editing code I implemented here isn't strictly correct. In an actual terminal, it seems the left and right arrow keys don't seem to do anything (other than print garbage). Shells like bash (but not dash, it seems) set the tty to non-canonical mode and implement that themselves. So this should probably be removed at some point, but is nice to have until the proper solution is available.

It seems best for me to share this code. I might look into ptys at some point.

ids1024 avatar Apr 22 '19 23:04 ids1024

Hey @ids1024, you seem like you know what you're doing. I'm just getting started with browsix. Do you think you can answer #69 for me?

As background, I'm looking exactly the browsix kernel with an xterm frontend, with one extra command line tool added. What you've built is perfect, and I'd ultimately love to figure out how to contribute.

Thanks in advance!

tcoulter avatar Aug 15 '19 07:08 tcoulter