9b395f5cc3
Build Chrome Extension / build (push) Waiting to run
Trigger Website Rebuild (Docs Updated) / dispatch (push) Waiting to run
E2E Headed Chrome / e2e-headed (macos-15) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (ubuntu-latest) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (windows-latest) (push) Has been cancelled
CI / build (macos-latest) (push) Has been cancelled
CI / build (ubuntu-latest) (push) Has been cancelled
CI / build (windows-latest) (push) Has been cancelled
CI / unit-test (push) Has been cancelled
CI / bun-test (push) Has been cancelled
CI / adapter-test (push) Has been cancelled
CI / smoke-test (macos-latest) (push) Has been cancelled
CI / smoke-test (ubuntu-latest) (push) Has been cancelled
Security Audit / audit (push) Has been cancelled
27 lines
898 B
Markdown
27 lines
898 B
Markdown
# 退出码
|
||
|
||
`opencli` 遵循 Unix `sysexits.h` 惯例,可无缝接入 shell 管道和 CI 脚本。
|
||
|
||
| 退出码 | 含义 | 触发场景 |
|
||
|--------|------|----------|
|
||
| `0` | 成功 | 命令正常完成 |
|
||
| `1` | 通用错误 | 未分类的意外错误 |
|
||
| `2` | 用法错误 | 参数错误或未知命令 |
|
||
| `66` | 无数据 | 命令返回空结果(`EX_NOINPUT`) |
|
||
| `69` | 服务不可用 | Browser Bridge 未连接(`EX_UNAVAILABLE`) |
|
||
| `75` | 临时失败 | 命令超时,可重试(`EX_TEMPFAIL`) |
|
||
| `77` | 需要认证 | 未登录目标网站(`EX_NOPERM`) |
|
||
| `78` | 配置错误 | 凭证缺失或配置有误(`EX_CONFIG`) |
|
||
| `130` | 中断 | Ctrl-C / SIGINT |
|
||
|
||
## 示例:根据退出码分支
|
||
|
||
```bash
|
||
opencli bilibili hot 2>/dev/null
|
||
case $? in
|
||
0) echo "ok" ;;
|
||
69) echo "请先启动 Browser Bridge" ;;
|
||
77) echo "请先登录 bilibili.com" ;;
|
||
esac
|
||
```
|