外部 CLI 新增 exec --terminal:在已打开的终端里执行命令

只允许登录一次的堡垒机(外部连接)上,exec 重新登录会被拒绝,另开通道又会结束会话。
--terminal 把命令打进这台主机在 ShellRS 里已打开的远程终端:先发 Ctrl-C,探测出
交互 shell(bash、dash、busybox ash)后输入命令行,经 OSC 标记取回输出、退出码和
执行上下文(--json 的 context)。不做忙碌检测,只拒绝全屏程序和同一终端已有一次运行。
外部连接上普通 exec 登录失败时,说明里提示改用 --terminal。

shells.yml 在 Docker 里对 bash 4.2–5.2、dash、busybox ash 跑真实终端测试。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
XuzandClaude Opus 5.5 committed 2026-10-08 16:16:30 +08:00
1 parent 3c937a9be2
commit e09adeefb7
22 files changed
+2432 -45

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
# `shellrs exec --terminal` against the shells it types into: bash 4.2 to
# 5.2, dash, busybox ash and a bash started as sh, each in a container on a
# real terminal (`terminal::run::tests::shells`). The Macs this is
# developed on run it only with Docker Desktop up.
#
# A push runs it when the run's code, the test helpers or the dependencies
# change; run it by hand otherwise (Actions › shells › Run workflow).
name: shells
on:
push:
branches: ["**"]
paths:
- "src/terminal/**"
- "src/testing.rs"
- "Cargo.toml"
- "Cargo.lock"
- "rust-toolchain.toml"
- ".github/workflows/shells.yml"
workflow_dispatch:
jobs:
shells:
runs-on: ubuntu-22.04
timeout-minutes: 90
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
- name: Build dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake clang pkg-config libfontconfig-dev \
libfreetype-dev libxkbcommon-dev libxkbcommon-x11-dev libwayland-dev \
libx11-xcb-dev libxcb1-dev libvulkan-dev libdbus-1-dev libssl-dev
# Pulled first, so that no test waits on a download.
- name: Images
run: |
for image in bash:4.2 bash:4.4 bash:5.0 bash:5.1 bash:5.2 \
debian:stable-slim alpine:3 rockylinux:9; do
docker pull --quiet "$image"
done
# rust-toolchain.toml picks the toolchain; this installs it with the
# components it lists before the cache key is computed.
- run: rustup toolchain install
- uses: Swatinem/rust-cache@v2
- run: cargo test --lib terminal::run -- --include-ignored