Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement a new method of interacting with bit-server: node-pty #9247

Merged
merged 11 commits into from
Oct 16, 2024

Conversation

davidfirst
Copy link
Member

@davidfirst davidfirst commented Oct 15, 2024

Until now we supported two methods to communicate with cli-server: SSE and TTY. See server-commander.ts for more details.

With this approach, we spawn a pty (pseudo terminal) process to communicate between the client and the server.
The client connects to the server using a (TCP) socket. The server writes to the socket and the client reads from it.
The client also writes to the socket and the server reads from it. See server-forever.ts to understand better.
In order to pass terminal sequences, such as arrow keys or Ctrl+C, the stdin of the client is set to raw mode.
In theory, this approach could work by spawning a normal process, not pty, however, then, the stdin/stdout are non-tty, and as a result, loaders such as Ora and chalk won't work.

With this new approach, we also support terminating and reloading the server. A new command is added bit server-forever, which spawns the pty-process. If the client hits Ctrl+C, this server-forever process will kill the pty-process and re-load it.

@davidfirst davidfirst marked this pull request as ready for review October 15, 2024 23:13
@davidfirst davidfirst changed the title wip, implement a new method of interacting with bit-server: node-pty implement a new method of interacting with bit-server: node-pty Oct 15, 2024
@davidfirst davidfirst enabled auto-merge (squash) October 15, 2024 23:19
@davidfirst davidfirst merged commit 470aeb9 into master Oct 16, 2024
11 checks passed
@davidfirst davidfirst deleted the cli-server-pty branch October 16, 2024 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants