Commit 046ef0b
extend process spawn to allow allocating a tty, attaching (#96)
using the same approach that `docker exec ...` uses:
- allow for allocating a tty when making a process
- expose an http endpoint that is hijack-able to do pure tcp stuff
`./cmd/shell` contains a proof of concept for what would eventually land
in the `kernel` CLI.
demo running against the image running in unikraft:
https://screen.studio/share/6imUEYCv
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Implements interactive PTY support for spawned processes and an
attach/resize workflow, plus a small CLI demo and minor wrapper tweaks.
>
> - Extends `ProcessSpawnRequest` with `allocate_tty`, `rows`, `cols`;
server spawns PTY-backed cmds via `creack/pty`, tracks `ptyFile/isTTY`,
and defers pipe readers in PTY mode
> - Adds raw attach endpoint `GET /process/{process_id}/attach` (HTTP
hijack) and `POST /process/{process_id}/resize`; enforces single active
attach and uses poll-based PTY→conn copy; cleans up FDs and retains
process status briefly post-exit
> - Updates OpenAPI (`openapi.yaml`) and generated client/server
(`lib/oapi`) to include PTY fields and `processResize`; adds deps
`creack/pty`, `x/sys`, `x/term`
> - New `cmd/shell` PoC: spawns `/bin/bash` with TTY, hijacks attach
over TCP/TLS, resizes on `SIGWINCH`
> - Wrapper scripts: ensure/export a sane `HOSTNAME` early in
headful/headless images
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
7d47214. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Sayan <[email protected]>1 parent 2ecdeeb commit 046ef0b
File tree
9 files changed
+1057
-167
lines changed- images
- chromium-headful
- chromium-headless/image
- server
- cmd
- api
- api
- shell
- lib/oapi
9 files changed
+1057
-167
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
36 | 52 | | |
37 | 53 | | |
38 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
33 | 46 | | |
34 | 47 | | |
35 | 48 | | |
| |||
0 commit comments